Excel Power Query: How to Update Data Source
In this article
To update the data source for a Power Query query in Excel, open the Queries & Connections pane, right-click the query, choose Edit, then go to Home > Data Source Settings (or click the gear icon next to the Source step in Applied Steps) and enter the new file path, URL, or server details. Click OK, then Close & Load to refresh the query with the new source. This guide walks you through the exact steps, plus how to handle common issues like broken file paths and credential prompts.
What You'll Need
- Excel 2016 or later (Power Query is built into the Data tab; in Excel 2010/2013 it's a separate add-in).
- The new data source accessible from your computer (local file, network share, database, or web URL).
- Necessary permissions and credentials for the new source.
- Basic familiarity with the Power Query Editor interface.
Step-by-Step
- Open the Queries & Connections pane. In Excel, go to the Data tab and click Queries & Connections (in some versions it's labeled Queries & Connections; the pane opens on the right). If you don't see it, look for the button in the Data tab's Get & Transform Data group.
- Edit the query. In the pane, right-click the query you want to update and select Edit. This opens the Power Query Editor window.
- Locate the source step. In the Applied Steps list on the right, click the first step (usually named Source). The formula bar shows the current source path or connection.
- Change the source. Do one of the following:
- Click the gear icon next to the Source step, then browse to the new file or enter the new URL/server details in the dialog that appears.
- Or, go to Home > Data Source Settings, select the current source, and click Change Source to update the path or connection.
- Confirm and apply. Click OK or Connect. Power Query will attempt to connect to the new source. If prompted for credentials, enter them and click Connect.
- Check the preview. The data preview should now show data from the new source. If columns or data types differ, you may need to adjust subsequent steps (e.g., remove or rename columns).
- Close and load. Click Close & Load (or Close & Load To… to choose where to place the data). The query refreshes and loads the updated data into your worksheet or data model.
Note: Menu labels can differ slightly by Excel version, device, or region. The steps above apply to Excel for Windows desktop; Excel for Mac has a similar but not identical interface.
Common Mistakes
- Editing the wrong step. Changing the source in a later step instead of the Source step can break the query. Always update the first step that defines the source.
- Forgetting to update credentials. If the new source requires different login, you'll get an error until you update credentials via Data Source Settings.
- Assuming column names stay the same. If the new file has different headers, subsequent steps (like Changed Type or Removed Columns) may fail. Check the preview and adjust steps as needed.
- Not refreshing after loading. After changing the source, you must refresh the query (Data > Refresh All) to see updated data in the worksheet.
- Using a relative path that breaks. If you move the workbook or share it, relative paths may not resolve. Use absolute paths or a consistent folder structure.
Tips
- Use parameters to make source changes easier. Create a parameter for the file path or server name, then reference it in the Source step. You can update the parameter without editing the query.
- Before changing the source, duplicate the query (right-click > Duplicate) as a backup, so you can revert if something goes wrong.
- If you frequently switch between sources, consider using a custom function or a parameter table to manage paths.
- Keep source files in a stable location (e.g., a network share) to avoid broken links.
- After updating the source, review the Applied Steps for any steps that reference specific column names or values that may no longer exist.
Troubleshooting
- Error: "DataSource.Error: Could not find file" – The path is incorrect or the file is missing. Verify the path in Data Source Settings and ensure the file exists.
- Error: "DataSource.Error: Access to the resource is forbidden" – Credentials are missing or incorrect. Go to Data > Get Data > Data Source Settings, select the source, and click Edit Permissions to update credentials.
- Query loads but data looks wrong – Check that the correct sheet/table is selected in the Source step. Also verify that the first row is used as headers if needed.
- Steps show errors after source change – Click the error step to see details. Common fixes: remove steps that reference missing columns, or re-add them based on the new data.
- Refresh fails with "Formula.Firewall" error – This can happen when queries reference each other. Try setting the query to load to the worksheet instead of the data model, or restructure to avoid cross-query dependencies.
- Credentials prompt keeps appearing – Set permission level to "Organizational" or "Private" as appropriate in Data Source Settings, and ensure "Ignore privacy levels" is not causing issues.
Frequently Asked Questions
Can I update the source for multiple queries at once?
No, each query must be edited individually. However, if queries share the same source, you can update the source in Data Source Settings for that connection, which may affect all queries using it.
What happens to my existing data when I change the source?
The data in your worksheet remains until you refresh. After changing the source and closing the editor, refresh the query to load the new data, which will overwrite the existing table.
Can I change the source from a file to a database?
Yes, but the steps may differ. In the Power Query Editor, you can replace the Source step with a new source (e.g., SQL Server) and then adjust subsequent steps to match the new data structure.
How do I update the source if the file has been moved?
Use Data Source Settings to change the file path to the new location. Alternatively, edit the Source step and browse to the new file.
Is it possible to update the source without opening the Power Query Editor?
You can update connection properties via Data > Queries & Connections > right-click query > Properties, but changing the actual source path typically requires the editor.
Why does my query still show old data after changing the source?
You likely haven't refreshed. After closing the editor, go to Data > Refresh All to update the output. Also check that the query is not set to "Refresh data when opening the file" only.