Dynamic Filepath for Excel Power Query Source

lucausa75

New Member
Joined
Oct 15, 2021
Messages
22
Office Version
  1. 2013
Platform
  1. Windows
Dear All,

I have an Excel Power Query I need to make the Source as dynamic based on the value on MyPN!K2 cell as in the below screenshot
Image

to have this line Source = Excel.Workbook(File.Contents("C:\TEST\MyFile\January2024.xlsm"), null, true), becaming Source = Excel.Workbook(File.Contents(MyPN!K2), null, true),

Any way to do it?
Thanks
 
Now I have the below issue:
2ERRR.png


2024-02-07 11_08_43-Advanced Editor.png


Thanks
 
Upvote 0

Excel Facts

Get help while writing formula
Click the italics "fx" icon to the left of the formula bar to open the Functions Arguments dialog. Help is displayed for each argument.
You need Name="FilePath" not Name=FilePath in the first one.
 
Upvote 0
Name="FilePath"
Great: now it works!
I have changed the first line from FilePath = Excel.CurrentWorkbook(){[Name="FilePath"]}[Content]{0}[DATA SOURCE] to FilePath = Excel.CurrentWorkbook(){[Name="FilePath"]}[Content]{0}[Column1]
 
Upvote 0

Forum statistics

Threads
1,215,093
Messages
6,123,066
Members
449,090
Latest member
fragment

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