Spreadsheets

Power Query workbook says file not found on another computer

Why a Power Query workbook says the file was not found on another computer, how the absolute path in the Source step causes it, and how to fix it for good.

Editorial illustration for Power Query workbook says file not found on another computer

The query says it cannot find the file because the Source step stores the full path to where the file lived on your computer, such as C:\Users\Asha\Documents\Statements\march.xlsx. On another PC that folder, or that user name, may not exist. Fix it by changing the data source path, and prevent it by putting the path in a parameter.

What does the error look like and why does it happen?

You will see something like "DataSource.Error: Could not find file" followed by a path. Open the query and look at the Source step: the file location is written inside File.Contents("...") as plain text. It is an absolute path, meaning it starts at the drive. Paths that include your Windows user name, or a OneDrive folder, differ on every computer. Even your own laptop after a reinstall, a new user profile or a drive letter change can break it.

CauseWhat differsQuick sign
Different Windows userThe user name inside the pathThe path has the old user name
OneDrive on another PCOneDrive folder name or sync locationPath contains OneDrive in a different form
Different drive letterE: on one machine, D: on anotherPath starts with the wrong letter
File renamed or movedThe file itselfThe path looks right but nothing is there

How do I fix it right now?

  1. Open the workbook and go to Data, Get Data, Data Source Settings.
  2. Choose Data sources in this workbook, select the broken path, and click Change Source.
  3. Browse to the file as it exists on this computer, and confirm.
  4. Close the dialog and refresh the query.

If that button is missing or the file is read in several places, open the query, then the Advanced Editor, and edit the quoted path in the Source step by hand. Make sure the backslashes, drive and file name match exactly.

How do I stop it happening again?

Put the path in one place and let the query read it. The simplest way is a parameter: Home, Manage Parameters, New Parameter, a text value, then Source = Excel.Workbook(File.Contents(FilePath), null, true). Now moving to another computer means editing one value. There is a separate walk-through for parameters on a statement folder.

A second option is to store the path in a worksheet cell and load it as a query, which lets a person who never opens the editor change it on the sheet.

Is there a way to avoid absolute paths altogether?

  • Keep the data in the same workbook as the queries, as a table, and read it with Excel.CurrentWorkbook. No file path exists, so nothing can break.
  • Keep the source file in a shared location that has the same path on every computer, which is rare outside organisations that manage this.
  • Save the workbook and its data in a single folder you copy as a whole, and use the parameter to point at it on each machine.

What should I check before sending the workbook to someone?

  1. Tell them where to put the source files, or send them in a folder with the workbook.
  2. Write the expected folder in a note on a Settings sheet next to the parameter.
  3. Open the workbook on a second computer, or ask them, to test one refresh before you rely on it.
  4. Clear the loaded data first if the file contains personal statements you do not wish to share, since the loaded rows travel with the workbook.

The last point matters for privacy: a workbook that holds statement rows holds your spending history. SpendixAI keeps records in your own workspace, with owners able to export data and delete transactions, which can be easier to manage than copies of files in several places.

SPENDIXAI JOURNAL

Useful ideas start with a clearer picture of your own spending.

Explore your reports