Forum Discussion
Power Query Source from Relative Paths
- Jun 20, 2018
Hi Magnus,
You may find the current file path putting in any cell of your workbook the formula
=LEFT(CELL("filename",$A$1),FIND("[",CELL("filename",$A$1),1)-1)
name this cell somehow, let say "FilePath" and generate absolute path in query like
<prev step> FilePath = Excel.CurrentWorkbook(){[Name="FilePath"]}[Content]{0}[Column1], FullPathToFile1 = FilePath & "Name1.xlsx" <next step>
Hi Magnus,
You may find the current file path putting in any cell of your workbook the formula
=LEFT(CELL("filename",$A$1),FIND("[",CELL("filename",$A$1),1)-1)
name this cell somehow, let say "FilePath" and generate absolute path in query like
<prev step> FilePath = Excel.CurrentWorkbook(){[Name="FilePath"]}[Content]{0}[Column1], FullPathToFile1 = FilePath & "Name1.xlsx" <next step>
Hey Sergei,
Could you please help me? My query sheet source is a folder, not a file, so every time a file is copied to the folder, the sheet is supposed to update. However, this only works on my device. I want to make the path relative so it works on any device. I followed similar steps for a single file, with some modifications to make it work for a folder, but it's not working.
In my sample file, my source looks like this in the Advanced Editor:
Power Query
Source = Excel.Workbook(Parameter1, null, true),
In the actual file, my query source looks like this:
Power Query
Source = Folder.Files("C:\adfads\adsfa\adfd"),
How do I make the relative path work on any device?
Thank you!