Power query editor data source settings multiple users

Eagleeyes011 Posts 27 Registration date Tuesday February 8, 2022 Status Member Last seen May 28, 2024 - May 22, 2024 at 04:22 PM
Eagleeyes011 Posts 27 Registration date Tuesday February 8, 2022 Status Member Last seen May 28, 2024 - May 28, 2024 at 10:46 AM

-In power query editor, how can I make the file path dynamic? Multiple users need to be able to run the power query. But each file path will be different due to being different users accessing the file. I’d prefer to not use permission based. If that’s reasonable. My efforts to change this given path have been futile with my online sources I’ve found.

-The source workbook name will be “generic source document”. I’ll need to change the workbook name later. The workbook name is static and does not change (the name given here is just a placeholder for our discussion). 

Related:

1 response

Eagleeyes011 Posts 27 Registration date Tuesday February 8, 2022 Status Member Last seen May 28, 2024 1
May 28, 2024 at 10:46 AM

To those who may be watching, I received this AI response (posted below). I don't understand line #8, and consequentially #9. The file is available to everyone (both the report file and the file that the information is being pulled from). I need for other users to have access to the report file that pulls information through power query on the report tool. But the file path is going to be different for everyone since they are using different credentials to access the file.

-For example, C:\users\usercredential_password_protected\onedrive - owning organization\username\drive location\file location\file name "report tool"

Below is the response from CCM AI

Hello !
The AI who loves a challenge is here!
You can use a parameter to define a dynamic file path in Power Query. Follow these steps to implement:

1. Open the Power Query Editor.
2. In the Home tab, go to 'Manage Parameters'.
3. Click 'New' to create a new parameter.
4. Name this parameter something like 'FilePath'.
5. For 'Type', select 'Text'.
6. For 'Current Value', type the full path of the file you're working with now (this is just a placeholder, it can be changed later).
7. Click 'OK'.
8. Now you can use this parameter to import data from the file. Go to 'New Source' > 'File' > 'Excel'. Now replace the static file path in the formula bar with your 'FilePath' parameter.
9. This code 'Excel.Workbook(File.Contents("C:\your_file_path_here"), null, true)' becomes 'Excel.Workbook(File.Contents(FilePath), null, true)'

Each user can change the location of the file in the 'Manage Parameters' table.

For workbook name: Create a new parameter, name it 'WorkbookName' and set the name of your workbook as the Current Value. Then you can use this parameter the same way we took care of the file path.

Remember: Changing parameter values will not automatically refresh your queries. Users will have to manually refresh the data.

Answer generated by IA on 23/05/2024

Thanks everyone who might be looking into this. This site has been such a big help!

0