PowerQuery - Dynamic Path

Paddo2010

New Member
Joined
Nov 14, 2022
Messages
5
Office Version
  1. 2021
Platform
  1. Windows
Hi ,

I have been able to create my first dynamic path linked to a folder. Still working to understand the logic involved in the the creation process.

My dynamic path seems to work but only if I update the name of the file in the advanced editor but I have seen people simply dragging and drop the new file link to the path they created and refresh to work without going back to the editor.

What am I doing wrong please? Thank you
 

Excel Facts

Does the VLOOKUP table have to be sorted?
No! when you are using an exact match, the VLOOKUP table can be in any order. Best-selling items at the top is actually the best.
Here is my process.

Step 1: Create a tab specific to the settings/lookup tables needed for Power Query use.
Step 2: On this settings tab, populate a cell with =LEFT(CELL("filename",A1),FIND("[",CELL("filename",A1))-1) . This formula will return the full network path for where the your file is currently located (based on most recent save)
Step 3: Name the cell in the Name Box to the left of the Formula Bar. I usually use Filepath
Step 4: In your Power Query, add in the following code:

If Data Source is an Excel File
Power Query:
let
    FilePath = Excel.CurrentWorkbook(){[Name="FolderPath"]}[Content]{0}[Column1],
    Source = Excel.Workbook(File.Contents(FilePath & "[Data Source File Name.xlsx"), null, true)
in
    Source

If Data Source is a CSV File
Power Query:
let
    FilePath = Excel.CurrentWorkbook(){[Name="FolderPath"]}[Content]{0}[Column1],
    Source = Csv.Document(File.Contents(Filepath & "[Data Source File Name.csv"))
in
    Source
 
Upvote 0

Forum statistics

Threads
1,224,820
Messages
6,181,159
Members
453,021
Latest member
Justyna P

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top