Power Query in Excel is the built-in tool for pulling data from files, folders, databases or web pages, cleaning it once, and then refreshing it with a single click when the source data changes. It lives on the Data tab as Get & Transform Data in current Windows versions (older builds may label the group Get & Transform), and every step you click is recorded as a query you can re-run. Menu labels can differ slightly by version, device and region, so look for the nearest equivalent name. Here is the shortest working path and then the detail.
What You'll Need
- Excel for Windows (Microsoft 365 or Excel 2016 and later). Power Query is included, not an add-in you download.
- Excel for Mac 2016 and later has Power Query, but the interface is less complete than on Windows; some connectors and options are missing.
- Your source data, plus permission to read it. For a database or SharePoint source you need working credentials.
- A place to land the result: a blank workbook or a spare sheet, ideally a table in the same workbook.
- For web scraping, the exact page URL. For a folder, the folder path containing the files.
Step-by-Step
- Save your workbook first. Queries are stored inside the file, and an unsaved crash can lose the connection setup you just built.
- Open the source or a blank workbook and go to the Data tab. On Windows the ribbon group is Get & Transform Data. Click Get Data to see the list of connectors.
- Pick the connector that matches your source. Common choices: From File > From Workbook for another Excel file, From File > From Folder to combine many files with the same layout, From Database > From SQL Server Database for a server, or From Web for a table on a web page. Choose the specific connector rather than the generic Other Sources entry, which asks for a hand-written connection string.
- Point at the data. Browse to the file or type the server and database name, then authenticate if prompted. For a workbook you will see a Navigator window listing sheets, tables and named ranges; tick one or more and use Preview to confirm the columns look right. Do not pick a sheet that mixes a title row, a blank row and a table, or you will spend the next ten minutes cleaning it.
- Choose where the result goes. Click Transform Data to open the Power Query Editor and shape the data first, or Load to drop it straight onto a worksheet. Transform Data is usually the better choice the first time.
- Clean the data in the editor. In the Power Query Editor window, the Applied Steps pane on the right records everything. Right-click a column header to rename it, or use Transform and Home ribbon buttons to remove duplicates, change type, split a column, filter rows or unpivot columns. Each click adds a step you can rename or delete later.
- Check the data types. Click the small icon at the left of each column header and set Text, Whole Number, Date and similar. Wrong types are the most common cause of broken refreshes, so do this before loading.
- Give the query a clear name. In the Query Settings pane, rename it from Query1 to something like SalesRaw. Descriptive names make the Queries & Connections pane usable when you have several.
- Load the result. Click Close & Load on the Home tab to place the output on a new worksheet, or Close & Load To to choose a location: a table on an existing sheet, a pivot table, or Only Create Connection if you just want the query available to other queries and pivot tables.
- Refresh when the source changes. On the Data tab click Refresh All, or right-click the result table and choose Refresh. The query re-runs every recorded step against the source and writes the new result.
- Set refresh options if the data is live. Right-click the query in the Queries & Connections pane and open Properties. There you can enable refresh when the file opens, set a background refresh interval while the workbook is open, and control how many rows are copied for a preview.
- Edit later without rebuilding. Double-click the query in the Queries & Connections pane, or use Data > Queries & Connections and the edit command, to reopen the editor. Delete or insert steps in the Applied Steps list instead of starting over.
Common Mistakes
- Typing a type change mid-query. Setting a column to Date before removing the stray blank rows or header junk leaves error-filled rows later. Clean first, change type last.
- Hard-coding a filter that will change. A hard-coded date or text filter silently excludes new data after the source moves on. Filter on a condition, or drive the value from a cell or parameter.
- Editing the loaded table directly. The output table is written by the query on every refresh. Any row you type into it disappears on refresh. Put extra calculations in helper columns on a separate sheet that points at the table.
- Assuming Mac looks the same. Power Query on Mac exists but lacks some connectors and options the Windows version has. If a Windows guide button is missing, the platform is the reason.
- Not pinning down the source path. File-based queries store an absolute path. Move or rename the source workbook and every refresh fails until the path is corrected in the query's source step.
- Leaving the default column names. Names like Column1 survive into pivot headings and formulas. Rename them in the editor where the change is recorded and repeatable.
Tips
- Keep a small sample workbook for developing a query, then repoint the source step at the full folder or database once the steps are right.
- Rename every step you might need to revisit. The default Changed Type names are meaningless once there are twenty of them.
- For many files in one folder, the From Folder connector combined with the combine-files button builds a single stacked table and keeps picking up new files added later.
- Use Only Create Connection when a query feeds a pivot table or a second query; this avoids cluttering sheets with duplicate copies of the same data.
- Sort the source data in the query rather than in the output table where possible, so the order survives every refresh.
- Keep heavy transformations out of the final worksheet. Large queries load faster as connections and are only materialised when something needs the rows.
Troubleshooting
Work from these checks in order; the first two solve most failures.
- Refresh does nothing or shows a stale result. Confirm you are refreshing the right query and not just a copied table. Use Refresh All and check the status bar for progress, then look in Queries & Connections for a query marked with an error icon.
- A red error appears on a step. Click the step in the Applied Steps pane and hover the error message. Usually one earlier step removed a column that a later step relies on, or a type change found text where it expected numbers. Fix the earlier step, not the last one.
- The file path is no longer valid. Move or rename the source back, or edit the Source step in the editor and enter the new path. If the source workbook was moved to OneDrive or SharePoint, note that local paths and synced paths are different.
- Sign-in or permission errors. Re-enter credentials for that source. For databases, confirm the account has read access to the tables, not only to the server. Signing out and back in to the work account is the safe next step.
- Mac shows fewer options. That is a platform limitation, not a corrupted install. Run the query on Windows if the missing connector is essential.
- Excel is very slow on refresh. Trim columns and rows early in the query, remove steps you no longer need, avoid loading huge query outputs to a worksheet, and disable background refresh while you are editing the file.
- Load fails with a shape or range problem. The output may clash with an existing table or be too large for the target range. Load to a new sheet as a test, then decide where it belongs.
Before any drastic step such as deleting a query or rebuilding a workbook, note that deleting a query removes all its recorded steps and the output table becomes an orphan; you can undo before saving, but not after. There is no reason to reset Excel for a query problem.
Frequently Asked Questions
Is Power Query free in Excel?
Yes. It is built into Excel for Windows from 2016 onward and is included with Microsoft 365 subscriptions. There is nothing extra to buy or download.
Does Power Query change my original data?
No. It reads the source and writes a new output. The source file stays as it was unless you deliberately overwrite it with a separate export step, which standard loading does not do.
Can I undo a Power Query step?
Yes, inside the editor. Delete or reorder entries in the Applied Steps pane. Changes are only committed to the workbook when you close and load, and you can close without keeping them.
Why does my query drop new rows after refresh?
A filter step or a fixed column selection is excluding them. Open the query and relax the filter, or check that the source range or file actually contains the new rows.
Can Power Query combine many files at once?
Yes, with From Folder. Point it at the folder, then combine the files on the same template. Files added to that folder later are included on the next refresh.
Does Power Query work on Excel for Mac?
It is available on Mac Excel 2016 and later, but with a reduced interface and fewer connectors than Windows. Expect some Windows menu paths described here to be missing.