
Section: Excel & Google Sheets
To use Power Query in Excel, open the Data tab, click Get Data, choose your source, shape the table in the Power Query Editor and click Close and Load. Every step you take is recorded in a query, so when the file changes you click Refresh and the same cleaning runs again without any formulas. This guide takes a messy CSV export through import, cleanup and load, then shows how to refresh it and what to do when a step breaks. The steps below describe Excel for Windows; menus, connectors and load destinations vary on Mac and the web. The example workflow is illustrative.
What Power Query is
Power Query is the import and shaping tool built into Excel. On older ribbons it appears as Get and Transform, which is the same thing. You connect to a source such as a CSV file, a folder of files, another workbook, a database or a web page, then apply steps: remove a column, change a data type, filter rows, split a column, merge two tables. The steps live in the query, not in cells, so the original data stays untouched.
That is the difference between a Power Query tutorial and a formula tutorial. A formula recalculates on the sheet. A query stores a recipe, and the recipe can be pointed at next month's file. This is why the tool is so common in monthly reporting, where the export arrives with the same columns every time. If you only need to flip rows and columns, the TRANSPOSE function is quicker than a query.
Where to find it
Open the Data tab and look for Get Data on the left of the ribbon. Everything here works in Excel for Microsoft 365, Excel 2021, 2019 and 2016 on Windows. Microsoft lists Power Query for Mac and Excel for the web too, but features and connectors differ by platform, so check your own version before you build a report around a specific data source.

Import a CSV file
- Click Data, then Get Data, then From File, then From Text/CSV.
- Browse to the file and click Import.
- Excel shows a preview. Set the delimiter and the data type detection if the preview looks wrong.
- Click Transform Data instead of Load, so the editor opens and you can clean the table first.
If you click Load by mistake, you can still right click the query in the Queries and Connections pane and choose Edit.
Clean the data in the editor
The editor is a separate window with a preview, a list of applied steps on the right and a ribbon of transformations. Work in this order and the query stays easy to read.
- Promote headers. If the first row became a data row, use Home, then Use First Row as Headers.
- Set data types. Click the icon in each column header and choose the type. Dates and numbers stored as text are the most common cause of broken totals later.
- Remove what you do not need. Select the columns to keep, right click and choose Remove Other Columns. Fewer columns mean a faster refresh.
- Filter rows. Use the arrow in a column header to drop blanks, subtotal lines or a test account.
- Split a column. Select the column, then Transform, then Split Column, then By Delimiter. This is how you separate a combined name or a code plus description.
- Remove duplicates. Select the key columns, right click and choose Remove Duplicates. It is the same idea as our guide to removing duplicates in Excel, but it runs on refresh. It works on the columns you select, not the whole row, which is usually what you want.
Each action adds a step to the Applied Steps list. Click any step to see the table as it looked at that moment, and delete a step if it did something you did not intend. Loading writes the result to its destination. Later refreshes can replace the loaded output, so keep manual edits outside that table.

Combine files from a folder
If the same report arrives as one file per week, use Get Data, then From File, then From Folder, point at the folder and click Combine. Power Query reads the files with the same layout and stacks them into one table. You can then filter on the file name or add a column from the file name, which is a quick way to keep the month or the branch in the result. This one feature removes most of the copy and paste from a reporting routine.
Load the result
Click Close and Load to send the table to a new worksheet, or Close and Load To for more control. The usual choices are a table on a sheet, a connection only, or the data model for use in a PivotTable. Choose Table when people need to see the rows. Choose Connection Only when the query feeds another query or a PivotTable and the rows are not needed on a sheet. A table loaded from a query behaves like any other table, so it can feed a chart or a PivotTable.

Refresh when the file changes
Right click the query in the Queries and Connections pane and choose Refresh, or use Data, then Refresh All. To make Excel do it for you, open the query properties and tick Refresh data when opening the file, and set a refresh every few minutes if you need it. The refresh reruns the stored steps against the source, so keep the source in a fixed location. Moving or renaming the CSV is the most common reason a query stops working.
A realistic example
Suppose a sales export arrives each month with 40 columns, three of which you need: date, region and amount. The date comes as text in a consistent day/month/year format, there is a totals row at the bottom, and the region names have trailing spaces. In Power Query you set the date type using the appropriate locale, filter out the totals row, trim the region column and remove the other 37 columns. Save the query. Next month you drop the new file in the same folder, click Refresh All, and the query rebuilds the clean table; completion time depends on the source and transformations. Compare that with rebuilding a set of formulas every month and the value is obvious.
Power Query compared with formulas
Use formulas when the data is small, changes constantly and people need to see every step in cells. Use Power Query when the data is large, arrives from outside Excel, needs the same cleaning every time, or needs to be combined from several files. Query work happens on refresh rather than on every cell recalculation. Workbook size depends on what you load; keeping a source copy and a loaded copy can increase it.

Common problems
- The query cannot find the file. The source was moved or renamed. Open the query settings and update the file path.
- A column type error appears. One value does not match the type you set, often a text note in a number column. Filter or replace the bad value before the type step.
- Headers changed. If the source renames a column, the step that refers to the old name fails. Rename the step or reapply the transformation.
- Refresh is slow. Remove columns and rows early, and avoid loading a query that only feeds another query.
- Numbers arrive as text. Use the type icon in the column header, not cell formatting. Formatting a column does not convert the values.
Questions and answers
Is Power Query the same as Get and Transform?
Yes. Get and Transform is the older name for the same feature.
Does Power Query change my original file?
No. It reads the source and writes the result to a table or the data model. The source file stays as it was.
Can I use Power Query for a one-off cleanup?
Yes, and it is often quicker than a chain of formulas, especially for removing duplicates and splitting columns.
Do I need to know M code?
No. The editor writes the M code for you. You only see it if you open the Advanced Editor, and you can ignore it entirely.
Does it work on a Mac?
Microsoft lists Power Query for Excel for Mac, but the connector list is shorter than on Windows. Check the connector you need before you commit to a design.
