Excel Power Query: Change a Data Source Step by Step

How-to basics · Updated November 21, 2026

To change a Power Query data source in Excel for Microsoft 365 on Windows, go to Data > Get Data > Data Source Settings, select the source, choose Change Source, enter the replacement location or connection details, and confirm. You can also edit a query’s Source step in Power Query Editor; that is often the clearest option when only one query needs a different file, folder, or server.

What changing a Power Query source actually changes

Power Query stores instructions for connecting to data and transforming it. A query might read a workbook from a file path, combine files in a folder, connect to a database, or import a table from a website. Its Source step identifies where the data comes from; later steps describe operations such as promoting headers, changing data types, filtering rows, and merging tables.

Changing the source changes the input location or connection, not necessarily the transformations that follow. If the replacement source has the same structure—such as the same column names and compatible data types—those steps may continue to work without edits. If the new source has different columns, table names, file formats, or permissions, the query can fail or return different results even though the connection itself was updated successfully.

This is different from changing a worksheet formula or simply replacing values in the loaded table. When you refresh, Power Query reads from its configured source again and applies the saved steps. Editing the results table directly does not normally change those instructions or the underlying source.

Change a source through Data Source Settings

Use Data Source Settings when you want to change the connection details for a source recognized by the workbook. In Excel for Microsoft 365 on Windows:

  1. Save the workbook, then select Data > Get Data > Data Source Settings. In some Excel builds, Data Source Settings is available from the Get Data menu on the Data tab.
  2. In the dialog, choose the source to update. If the dialog offers a choice between data sources in the current workbook and global permissions, select the workbook’s source for a workbook-specific change.
  3. Select Change Source. The available fields depend on the connector. For a file, browse to the replacement file; for other connectors, update the relevant server, database, URL, or location.
  4. Confirm the change, close the dialog, and refresh the query. If Excel asks you to choose how to connect or sign in, provide the appropriate credentials.

The exact dialog depends on the source type, and not every connector presents the same Change Source controls. Data Source Settings also manages saved permissions and credentials. Clearing or editing permissions there is not the same as changing the source address: removing credentials may simply make the next refresh ask you to sign in again.

Edit the Source step in Power Query Editor

For a single query, editing its Source step is often more direct. Select Data > Queries & Connections, find the query, right-click it, and choose Edit. In Power Query Editor, look at the Applied Steps list on the right. If the Source step has a settings icon, select it and change the relevant location or connection details in the dialog.

If there is no settings icon, select the Source step and inspect the formula bar. If it is hidden, turn it on with View > Formula Bar. Some connectors also let you use Home > Advanced Editor to inspect or edit the query’s M code. For example, a file-based query may contain a path in a File.Contents expression. Change only the location you intend to change; editing M code incorrectly can prevent the query from loading.

After changing the source, check the preview in the editor. Confirm that the expected table or sheet is selected and that the first rows and column headers look right. Then choose Home > Close & Load, or Close & Load To if you need to change where the results are loaded. Loading the query to a worksheet does not itself change its source.

Change file, folder, database, and web sources

The right method depends on the connector. For a file-based query, the source may be an Excel workbook, CSV, text file, or another supported file type. Browse to the replacement file or update the path in the Source step. If the file moved but its columns and sheet or table names stayed the same, existing transformations often remain usable. If the replacement workbook uses a different sheet name, you may also need to update a later Navigation step.

For a folder query, check that the new folder contains the intended files and that it does not include extra files, temporary files, or files with a different layout. A combine-files query generally relies on a sample file to determine how to transform each item. Changing the folder can therefore expose inconsistencies that were not present in the original folder.

For a database, SharePoint, or web connection, update the server, site, URL, database, or other connector-specific field rather than typing a file path into an unrelated setting. You may need permission to access the new location. A web address that opens in a browser is not automatically a valid Power Query endpoint; the connector may require a particular URL format or authentication method.

Changing a source from one connector type to another can be more involved than pointing to a new location. For example, replacing a CSV with a database table may change the structure of the Source and Navigation steps. In that case, creating a new query with the correct connector and adapting the transformations can be safer than trying to force the old connection to behave like a different source type.

Use a parameter for sources that change regularly

If you repeatedly switch between locations, consider using a Power Query parameter instead of editing a hard-coded path each time. A parameter stores a value—such as a folder path, file name, server, or database name—that a query can reference. When the location changes, update the parameter and refresh queries that use it.

In Power Query Editor, parameters can be created or managed through Home > Manage Parameters. The precise controls depend on the parameter’s data type and how the query uses it. A parameter does not automatically make every part of a connection dynamic: some connectors impose rules on dynamic data sources, particularly in shared or online refresh scenarios. Test the workbook in the environment where it will be refreshed, especially if it is used by other people or published to a service.

Parameters are useful when several queries share a location, such as a folder path used by multiple file queries. They reduce the chance of updating one query while leaving another pointed at the old location. For a one-time move of a single file, editing the Source step is usually simpler.

Check related queries, refreshes, and credentials

Before changing a source used by a workbook, identify which queries depend on it. In Data > Queries & Connections, review the query list and its connections; in Power Query Editor, examine the query dependencies where available. A query may reference another query rather than connect directly to a file. Updating the original source query can affect every dependent query, while changing a separate query may leave the others untouched.

After the change, refresh the query and review both the preview and the loaded result. A successful refresh only confirms that Power Query could run; it does not prove that the data is the intended data. Check a few recognizable records, the row count, column headings, and any totals or filters that matter to your task.

If the new source requires different access, review the authentication prompt and the permissions associated with that source. Avoid sharing passwords in workbook notes or embedding secrets in query text. For organizational databases and cloud services, use the sign-in method approved by the organization. A coworker may have to authenticate separately if their account does not have the same access as yours.

Common errors and practical fixes

  • File not found: Check spelling, drive letters, folder names, and whether the file is available on the computer running the refresh. A mapped network drive may not exist for another user. A shared, stable network or cloud location can be more reliable for team workbooks.
  • Column or key not found: The new source may have renamed or removed a column, sheet, table, or database field expected by a later step. Find the first step that shows an error and update the relevant selection or transformation.
  • Access denied or credentials rejected: Confirm that the signed-in account has permission to the new source. In Data Source Settings, review the permissions for the correct source, then authenticate again if needed.
  • Wrong data appears after refresh: Verify the full source path and the selected sheet, table, or folder. A similarly named file or an unexpected folder item can load successfully while still being the wrong input.
  • Refresh takes much longer: A new folder may contain more files, or a database connection may return a larger dataset. Check source contents and filters before assuming that the source change has broken the query.

A useful troubleshooting habit is to identify the earliest failing step, rather than changing later transformations at random. If Source succeeds but Navigation fails, the connection is likely reachable and the selected object may have changed. If the Source step itself fails, check the address, connector, network availability, and permissions first.

Windows, Mac, and Excel for the web

The steps above describe Excel for Microsoft 365 on Windows, where the full Power Query editing experience is available. Excel for Mac supports Power Query features, but connector availability and editing controls can differ by Excel version and update channel. Menu wording and the set of supported source types may also vary. If a Mac build does not expose the needed source-editing control, open the workbook in desktop Excel for Windows to make the change, then verify that the query can refresh in the environment where it will be used.

Excel for the web can work with some Power Query content, but its editing and connector capabilities are not identical to the Windows desktop application. Do not assume that a query editable on Windows can be fully reconfigured in a browser. For a source change involving a connector, credentials, or advanced M code, use the supported desktop editor and confirm online refresh requirements separately.

Frequently Asked Questions

How do I change the file path in an Excel Power Query?
Open the query from Data > Queries & Connections, select Edit, and change the Source step’s file location if its settings are available. You can also use Data > Get Data > Data Source Settings, select the workbook source, and choose Change Source.

Will changing the source delete my Power Query steps?
Usually, changing the location while keeping a compatible source structure leaves later steps in place. Steps can fail if the replacement source has different column names, sheet names, tables, or data types. Check the preview and resolve any errors before loading.

Can I change the source for several queries at once?
If the queries use the same recognized source, Data Source Settings may let you update that source connection. If they contain separate hard-coded locations, update each query or configure them to use a shared parameter. Check dependent queries before refreshing.

Why can’t I see Change Source?
The selected source or connector may not expose that control in the dialog, or you may be looking at global permissions rather than the workbook’s source settings. Try editing the query’s Source step in Power Query Editor. Some connection changes require changing the M code or creating a replacement query.

Do I need to refresh after changing a source?
Yes. The change updates the query instructions, but refreshing runs them against the new location and updates the query preview or loaded output. Review the refreshed data to make sure it is the intended source and that all transformations still work.

Related

Try it: the Date Difference Calculator: days, months, years and weekdays between two dates, with the DATEDIF formulas.

More in How-to basics

Sources: Function behaviour and menu paths: Microsoft Support documentation for Excel. Method & sources

Spotted an error in this guide? Let us know.