Oct 01 2024 07:31 AM
My boss created an Excel data model before I joined the company. He created the data model and queried the data from files within his personal drive. Now that I am here, he wants me to have access to these files and has moved them into a shared folder. The thing is, all of the queries now have the wrong file path. Is the only way to fix this to manually update the file path within the Source step of the power query editor? If there is an easier way, please let me know!
Oct 01 2024 07:48 AM
That's to update manually. For future updates use paths as parameters, at least folder part of it.
Oct 01 2024 08:00 AM
Oct 01 2024 11:24 AM
If you have queries like
let
Source = Excel.Workbook(File.Contents("C:\Test\testA.xlsx"), null, true),
Sheet = Source{[Item="Sheet1",Kind="Sheet"]}[Data]
in
Sheet
you may create parameter
and change queries to
let
Source = Excel.Workbook(File.Contents( pFilePath & "testA.xlsx"), null, true),
Sheet = Source{[Item="Sheet1",Kind="Sheet"]}[Data]
in
Sheet
Next the only you need is to edit parameter at one place. In general you may use parameters for full filenames; or keep them in grid, call by another query and combine in main queries, etc. Depends on your needs.