
📎 This article includes 1 downloadable practice file ↓
Every month someone drops twelve branch files in a shared folder and you copy-paste them into one sheet. Power Query — built into Excel 2016 and later as Get & Transform — does this in a few clicks, and next month you just press Refresh.
In this article
Step by step
- Data → Get Data → From File → From Folder, and pick the folder.
- Excel lists the files. Click Combine → Combine & Transform Data.
- Choose the sample file and the sheet or table to use. Power Query uses it as the template for all files.
- The Power Query editor opens with every file stacked, plus a
Source.Namecolumn showing which file each row came from — keep it. - Clean once: remove blank rows, set data types (dates as Date, amounts as Decimal Number), rename columns.
- Home → Close & Load. You get one table in Excel.
Next month, drop the new files in the folder and click Data → Refresh All. Done.
Filter out the junk files
Folders collect temporary files, old versions and random PDFs. Right after the Source step, filter:
Extensionequals.xlsx(or.csv).Namedoes not begin with~$— those are lock files Excel creates while a workbook is open.
Excel.CurrentWorkbook()) so colleagues can change the folder without opening the editor.When headers differ between files
Power Query matches columns by name. If one branch writes “Amount” and another “Amt”, you get two half-empty columns. Fix it at the source if you can; otherwise add a Rename Columns step in the sample-file query (the “Transform Sample File” query), which is applied to every file.
Power Query vs VBA vs Python
| Power Query | VBA | Python | |
|---|---|---|---|
| Coding needed | No | Yes | Yes |
| Refresh | One click | Run macro | Run script |
| Best for | Repeatable monthly merges | Custom workbook logic | Huge data, many formats |
Prefer code? See merge Excel files with Python.
Try it yourself: step by step
- Download branch-files.zip and unzip it — you get a Monthly folder with four branch workbooks (North, South, East, West).
- Open a new blank workbook → Data → Get Data → From File → From Folder → select the Monthly folder → Combine & Transform Data.
- In the dialog pick the sheet named Data and click OK. Power Query stacks all four files and adds
Source.Name. - Set types: click the Date column icon → Date; Qty and Price → Whole Number. Close & Load. You should see 60 rows.
- Test the refresh: copy one branch file inside the folder (e.g. North_branch – Copy.xlsx), then Data → Refresh All. Rows increase — delete the copy and refresh again.
- Make a pivot table from the loaded table with
Source.Namein Rows and Qty in Values to check each file contributed.
📎 Practice files for this article
- 🗂️4 branch workbooks (zip)Unzip into a folder, then follow Data u2192 Get Data u2192 From Folder.⬇ ZIP · 21 KB
Free to use for learning. Files with macros (.bas) are plain text — import them with Alt+F11 → File → Import File, and always test on a copy.