Forum Discussion

FlorisMK's avatar
FlorisMK
Icon for Helper I rankHelper I
2 years ago
Solved

Refer to worksheet-scope Named Range

I can refer to an Excel named range in Power Query thus:   Excel.CurrentWorkbook(){[Name="MyNamedRange"]}[Content]{0}[Column1]   Unfortunately, as far as I can tell, this only works if MyNamedRan...
  • OwenAuger's avatar
    2 years ago

    Hi FlorisMK 

    Based on your question, I take it you are using Power Query within Excel - is that right?

     

    I did some testing at my end, and Power Query appears to be able to access both worksheet-scoped and workbook-scoped named ranges.

     

    For example, I have these named ranges in an Excel workbook:

    and these appear as follows when I connect to the workbook in Power Query:

    You could query the content of a worksheet-scoped range Range_Sheet3 on sheet Sheet3 using:

    = Excel.CurrentWorkbook(){[Name="Sheet3!Range_Sheet3"]}[Content]

     or for the top-left cell

    = Excel.CurrentWorkbook(){[Name="Sheet3!Range_Sheet3"]}[Content]{0}[Column1]

    and this would allow parameterising as necessary depending how queries are organised.

     

    Does this help?

     

    Regards