This code makes Power Query reference a content in a file with variable (or uknown) sheet name.

  • let
       Source = Excel.Workbook(File.Contents("C:\Users\HP\Desktop\file.xlsx"), null, true),
       x = Table.SelectRows(Source, each [Kind] = "Sheet"){0}[Data]

Zero says "take the first sheet", because in M we start at zero. So if you need the second sheet, just use "1" etc.

For more detailed info click here.

Leave a Reply

Your email address will not be published.


clear formPost comment