Forum Discussion

pollenwitcher's avatar
pollenwitcher
New Member
16 days ago
Solved

undefined

I use Power Query in Excel, and my source data is stored in OneDrive, which is synced to my PC. If I move to another PC, the file path changes and Power Query may no longer detect the source. I also ...
  • Jai-Rathinavel's avatar
    15 days ago

    Hi pollenwitcher , You can Parameterize the excel folder or file path and include it in your Power Query to make it dynamic. The other users just have to copy paste their local path as an one time activity and refresh the power bi file.
    1. Create a Parameter using Manage Parameters option and Provide your excel file path

     

    2. Replace the existing File Path with the new parameter which you have created

     


    Hope this helps.

  • DataTako's avatar
    12 days ago

    Hey,

     

    The root of this is that you're pointing Power Query at the local synced path (something like

    C:\Users\you\OneDrive - Company...), and that path is different on every machine. The fix is to reference the file by its OneDrive/SharePoint URL instead, so it resolves to the same location for everyone regardless of where their sync folder lives.

     

    Quickest way to get that URL: open the source file, go to File > Info > Copy path. That gives you a URL ending in ?web=1. Delete the ?web=1 part, and use what's left in Power Query.

     

    Then swap your source step to use the URL. For a single workbook, wrap it in Web.Contents:

    Excel.Workbook(Web.Contents("https://yourtenant-my.sharepoint.com/personal/.../file.xlsx"), null, true)

    If the data lives in a SharePoint document library rather than personal OneDrive, SharePoint.Contents or SharePoint.Files against the site URL is cleaner and behaves the same for every user.

     

    Two things to know before you share:

    Everyone needs permission to the source file, and they'll authenticate with their Organizational Account the first time (Data source settings > Edit permissions if it prompts). Once that's set, the path never needs touching again.

    This works properly with OneDrive for Business / SharePoint. Personal (consumer) OneDrive is much more awkward to reference by URL, so if this is a work setup, make sure the file sits in OneDrive for Business or a SharePoint library.

     

    Do that and the path stops being machine-dependent, so when colleagues open the shared file they won't have to reconfigure anything.

     

    If this answers your question, please mark it as the solution so others with the same setup find it faster.

     

    Paco
    Helping data analytics leaders distribute their reports