Power Query - Dynamic Path issue

Mumba

New Member
Joined
May 3, 2018
Messages
14
Hi All

I am building a Power Query that holds a dynamic Path to a folder that holds my data input files.
I have managed to set it up so that the path is dynamic.
My big issue is that when i change the path I get an error because the sheet selection is based on the static path given before the change.
How do a make this dynamic???

Issues start in the second line holding a #

Power Query:
let
  Source = Excel.CurrentWorkbook(){[Name = "DynamicPath"]}[Content],
  Path = Source{0}[Dynamic Path],
  GetFolderFiles = Folder.Files(Path),
    #"C:\Material_Segmentation\PlantSite Data\_MB51 XLSX" = GetFolderFiles{[#"Folder Path"="C:\Material_Segmentation\PlantSite Data\",Name="MB51.XLSX"]}[Content],
    #"Imported Excel" = Excel.Workbook(#"C:\Material_Segmentation\PlantSite Data\_MB51 XLSX"),
    Sheet1_Sheet = #"Imported Excel"{[Item="Sheet1",Kind="Sheet"]}[Data],
 

Excel Facts

Can a formula spear through sheets?
Use =SUM(January:December!E7) to sum E7 on all of the sheets from January through December

Forum statistics

Threads
1,214,864
Messages
6,121,986
Members
449,058
Latest member
oculus

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