Combine All Excel Files in a Folder with Power Query (No VBA, No Copy-Paste)

Combine All Excel Files in a Folder with Power Query (No VBA, No Copy-Paste)

📎 This article includes 1 downloadable practice file ↓

⏱ 3 min readUpdated 27 September 2026

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
  1. Step by step
  2. Filter out the junk files
  3. When headers differ between files
  4. Power Query vs VBA vs Python
  5. Try it yourself: step by step

Step by step

  1. Data → Get Data → From File → From Folder, and pick the folder.
  2. Excel lists the files. Click Combine → Combine & Transform Data.
  3. Choose the sample file and the sheet or table to use. Power Query uses it as the template for all files.
  4. The Power Query editor opens with every file stacked, plus a Source.Name column showing which file each row came from — keep it.
  5. Clean once: remove blank rows, set data types (dates as Date, amounts as Decimal Number), rename columns.
  6. 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:

  • Extension equals .xlsx (or .csv).
  • Name does not begin with ~$ — those are lock files Excel creates while a workbook is open.
💡 Point the query at a folder path stored in a cell (a named range read with 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

  1. Download branch-files.zip and unzip it — you get a Monthly folder with four branch workbooks (North, South, East, West).
  2. Open a new blank workbook → Data → Get Data → From File → From Folder → select the Monthly folder → Combine & Transform Data.
  3. In the dialog pick the sheet named Data and click OK. Power Query stacks all four files and adds Source.Name.
  4. Set types: click the Date column icon → Date; Qty and Price → Whole Number. Close & Load. You should see 60 rows.
  5. 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.
  6. Make a pivot table from the loaded table with Source.Name in 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.