Forum Discussion
Kashibaba
Oct 15, 2019Brass Contributor
Power Query Excel data from Variable / Dynamic Worksheet...
Hi All, I'm using power query to pull data from a weekly file via filepath and name in cell reference, which is working perfectly. However when I change week number, worksheet name for next week f...
SergeiBaklan
Oct 15, 2019Diamond Contributor
You may change in Navigation step the code which is usually looks like
Sheet1_Sheet = Source{[Item="Sheet1",Kind="Sheet"]}[Data],
on
Sheet1_Sheet = Source{0}[Data],
Other words, use relative reference instead of absolute one.
SamToledanes
Feb 18, 2021Copper Contributor
SergeiBaklan thanks for this man. this really helped me on appending all of the data as one table I'm new to queries, VBA and pivot so I'm in a newbie stage.
- monojchakrabortyMay 10, 2022Copper Contributor
HiSamToledanes,
Its an elegant solution as it becomes 'sheet-name' agnostic.
I was wondering if it is possible to store the sheetname to import as a query parameter and then supply that where it is required to insert the name of the sheet?
Appreciate
- SergeiBaklanMay 10, 2022Diamond Contributor
You may name the cell in the grid which has sheet name, query it and use result in other queries, like
getSheetName = Excel.CurrentWorkbook(){[Name="sheetname"]}[Content]where "sheetname" is the name of the cell.