Power Query basics in Excel: automate data cleanup (Get Data and Refresh)
Set up a monthly chore once with Power Query: Get Data, cleanup steps, Applied Steps, Refresh All and the most common Power Query mistakes.
Every month it’s the same: you export a report from your accounting system or bank, and it comes with a title row on top, blank rows, stray spaces, amounts stored as text and a Total row at the bottom. Cleaning it takes 30–40 minutes — and you repeat the exact same work each time.
Power Query records those actions once. Next month you replace the file and press one button — Refresh All. Every step reruns in seconds. Power Query is built into Excel 2016 and later on the Данные tab (Get & Transform Data group); no formulas required — it’s all buttons.
| A | B | C | D | E | |
|---|---|---|---|---|---|
| 1 | Report: January 2025 | ||||
| 2 | Date | Branch | Product | Amount | |
| 3 | 05.01.2025 | Tashkent | BREAD | 4 500 000 | |
| 4 | 06.01.2025 | Samarkand | milk | 7 200 000 | |
| 5 | |||||
| 6 | 06.01.2025 | Samarkand | milk | 7 200 000 | |
| 7 | 07.01.2025 | tashkent | meat | 6 800 000 | |
| 8 | Total | 18 500 000 | |||
| 9 |
| A | B | C | D | E | |
|---|---|---|---|---|---|
| 1 | Date | Branch | Product | Amount | |
| 2 | 05.01.2025 | Tashkent | Bread | 4 500 000 | |
| 3 | 06.01.2025 | Samarkand | Milk | 7 200 000 | |
| 4 | 07.01.2025 | Tashkent | Meat | 6 800 000 | |
| 5 |
Loading data into Power Query
1
On the Данные tab choose Получить данные → From File.
| A | B | C | D | E | |
|---|---|---|---|---|---|
| 1 | Date | Branch | Product | Amount | |
| 2 | |||||
| 3 | |||||
| 4 | |||||
| 5 |
2
Pick the file type: From Text/CSV for CSV, From Workbook for an Excel file, From Folder for a whole folder. If the data is already in this workbook, select the range and choose From Other Sources → From Table/Range. For a table on a website — From Web.
| A | B | C | D | E | |
|---|---|---|---|---|---|
| 1 | Date | Branch | Product | Amount | |
| 2 | |||||
| 3 | |||||
| 4 | |||||
| 5 |
3
Choose the file. In the preview window click Transform Data, not Load — the Power Query Editor opens. Load would dump the file onto a sheet without any cleanup.
Cleaning up in the Power Query Editor — 6 steps
1
Home → Remove Rows → Remove Top Rows → 1. The “Report: January 2025” row is gone.
2
Home → Use First Row as Headers — Date, Branch, Product and Amount become headers.
3
Filter button on the Date column → untick (null) and Total. The blank row and the total row disappear. Then Home → Remove Rows → Remove Duplicates — the duplicate goes.
4
Select the Branch and Product columns: Transform → Format → Trim (spaces at the edges), then Capitalize Each Word (“tashkent”, “BREAD” → “Tashkent”, “Bread”).
5
Amount column: Transform → Replace Values — replace the space with nothing, then the type icon in the header → Whole Number. Date column: type icon → Using Locale... → Date, locale Russian (Russia) or another day.month.year locale.
6
Home → Close & Load. The result lands on a new sheet as an Excel Table. The query appears in the Queries & Connections pane on the right.
| A | B | C | D | E | |
|---|---|---|---|---|---|
| 1 | Date | Branch | Product | Amount | |
| 2 | 05.01.2025 | Tashkent | Bread | 4 500 000 | |
| 3 | 06.01.2025 | Samarkand | Milk | 7 200 000 | |
| 4 | 07.01.2025 | Tashkent | Meat | 6 800 000 | |
| 5 |
Next month: one button
Save the February report in the same folder under the same name (over the old one). Then Данные → Обновить все or Ctrl + Alt + F5. Power Query rereads the file and replays every step in Applied Steps in order. 40 minutes of manual work become 5 seconds.
A different number of rows each month is no problem: the steps are stored as rules (“remove row 1”, “filter out Total”), not as specific cells.
| A | B | C | D | E | |
|---|---|---|---|---|---|
| 1 | Date | Branch | Product | Amount | |
| 2 | 01.02.2025 | Bukhara | Bread | 3 900 000 | |
| 3 | 02.02.2025 | Tashkent | Milk | 5 100 000 | |
| 4 | 03.02.2025 | Samarkand | Meat | 12 400 000 | |
| 5 | 04.02.2025 | Tashkent | Bread | 4 800 000 | |
| 6 |
Pro level: folders, Unpivot and Merge
- From Folder — 12 files into one table. Put every monthly file in one folder: Get Data → From File → From Folder → Combine & Transform Data. Drop a new month’s file in the folder and Refresh picks it up automatically.
- Unpivot Columns turns a table with months spread across columns (Jan, Feb, Mar...) into a long “Month | Amount” table — the ideal shape for PivotTables and formulas.
- Merge Queries joins two tables on a key: a replacement for VLOOKUP/XLOOKUP that stays fast on hundreds of thousands of rows.
- Group By — grouping and totals inside Power Query (similar to SUMIF).
- Close & Load To... → Only Create Connection keeps helper queries off the sheet; PivotTable Report sends the result straight into a PivotTable.
Behind every step there is code in the M language (View → Advanced Editor). You don’t need to know it, but peeking is useful. The same skills work one-to-one in Power BI.
Has ExcelLab been useful?
Support the project and help us release new lessons and exercises.