Forum Discussion

Analitika's avatar
Analitika
Post Prodigy
5 years ago

=Excel.CurrentWorkbook()

How work this function?

=Excel.CurrentWorkbook()

 Which is current workbook? I always got emtpy fields

Do i need specify any workbook name and path?

Do it take everithing from Activeworkbook?

10 Replies

  • Hi Analitika ,

     

    This is a function expression so it does not expect any parameters. If you leave has is it will give you am option to invoke the function that will get all the tables ni the excel file (if you do not have any tables this will return an empty table).

     

    If you know the exact table name you need you can change this syntax by adding the name of the table something similar to:

     

    = Excel.CurrentWorkbook(){[Name="TableName"]}[Content]

     

     

    This will invoke the table and you will get the information without the need of addittional steps.

  • Greg_Deckler's avatar
    Greg_Deckler
    Community Champion

    Analitika Probably a good question for ImkeF , edhans  and HotChilli 

     

    My Excel queries generally look like this though:

    let
        Source = Excel.Workbook(File.Contents("C:\Users\gdeckler\Downloads\ItemUnit.xlsx"), null, true),
        Ancilliary_Table = Source{[Item="Ancilliary",Kind="Table"]}[Data],
        #"Changed Type" = Table.TransformColumnTypes(Ancilliary_Table,{{"Item no", Int64.Type}, {"Product Description", type text}, {"Qty", Int64.Type}, {"Sale", type text}, {"Attribute.1", type text}, {"Value", type any}})
    in
        #"Changed Type"
  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi Analitika,

    In fact, there are a few differences between excel and power bi and correspond Dax/m query formula. (it probably related to excel/ power bi data models, mechanism, and backend processing)
    As MFelix said, the function that you mentioned seems like required some global variables that excel provided so it can't work properly on the power bi side.
    Regards,

    Xiaoxin Sheng

  • Hi

    I do this on my desktop PC and use two options:

    The one is a table and the other a named range as source.

     

    They both work on my local machine.

     

    When I upload to SharePoint and Refresh All, the table based one works perfectly, but the named range based one give "key do not match any rows in the table error.
    I open the file obviously using Excel For the Web.

    Why is it able to use table and range name as source on my esktop, but on the weg, it gives error with the named range version?

    Totally in the dark here....