I'm having multiple PowerQuery queries that I would like to feed the value of a cell in my Excel file. In this particular case, the full path to the sourcefile name.
Is there any way I can get this into PowerQuery?
Power Query can´t take value from a cell using reference like "C2", but it can work with an inserted table. This table can only have one row, containing the cell we need. So to get the value of cell we can simply write this code into first step of query: = Excel.
You can right-click a particular cell in a column to open the shortcut menu for that value. Point to the small filter icon, and then select the filter option you want to use. Power Query displays a type-specific filter based on the data type of the column.
This can be achieved using a named range and a custom function in PowerQuery:
SourceFile
(rangeName) => Excel.CurrentWorkbook(){[Name=rangeName]}[Content]{0}[Column1]
GetValue
(Name property in the Query settings pane on the right)Now you can access the named cell in your queries, using GetValue(cellName)
- e.g.
= Excel.Workbook(File.Contents(GetValue("SourceFile")))
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With