Forum Discussion

Ocasio27's avatar
Ocasio27
Iron Contributor
Mar 02, 2020
Solved

Adding query from the same worksheet

I want to add a query in the powerquery option from Tables inside the worksheet, so far only way I have found to do it is by opening the excel file itself as a query which is very inefficient.

 

I know the code "Source = Excel.CurrentWorbook()" is used for this but, can someone give me an example of how to use this.

 

Lets say my table is called "table1" and I want to add is as a query.

Also, if its a sheet, "sheet1"

  • You can use From Table/Range in the PQ menu area, or this code if you want to code instead: = Excel.CurrentWorkbook(){[Name="MyTableName"]}[Content]

5 Replies

  • Savia's avatar
    Savia
    Iron Contributor
    You can use From Table/Range in the PQ menu area, or this code if you want to code instead: = Excel.CurrentWorkbook(){[Name="MyTableName"]}[Content]
    • Ocasio27's avatar
      Ocasio27
      Iron Contributor

      Savia 

       

      I got this error when I try

      "Formula.Firewall: Query 'Query1' (step 'Source') references other queries or steps, so it may not directly access a data source. Please rebuild this data combination."

       

      Formula was

       

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

      • Savia's avatar
        Savia
        Iron Contributor
        The option is in the Data menu in Excel in newer Office versions, or the Power Query menu in older ones. If adding directly from PQ just make a custom query. And it looks like you're missing the "" around the table name: = Excel.CurrentWorkbook(){[Name="Table1"]}[Content]
    • Ocasio27's avatar
      Ocasio27
      Iron Contributor

      Savia 

      I cannot find that table/range option in PQ. Which tab is that?

Resources