Power Query and referencing sheet with variable name
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]
in
x
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.