New Tool Radar

AI for Data & Spreadsheets

How to Combine a Folder of Same-Layout Files With Power Query

Point Power Query at a folder of same-layout files and combine them into one table that refreshes when new files arrive.

Schematic with three steps: Combine the folder; Fix the sample file query; Check the combined table and refresh.

When one file arrives per period with the same layout, From Folder combines them all: Power Query builds the combined query from a sample file, and new files dropped into the folder appear after Refresh. It works well when the layout is identical and badly when it is not.

What you need

  • Excel with Power Query
  • A folder holding files with identical layouts
  • A copy of the folder

Step 1: Combine the folder

Use Data, Get Data, From File, From Folder, choose the folder and click Combine. Power Query shows a preview using a sample file and builds a Transform Sample File query.

Step 2: Fix the sample file query

If the data starts on row 7 or has a header line to skip, fix it in the Transform Sample File query: remove the top rows and promote the headers there. The change applies to every file in the folder.

Step 3: Check the combined table and refresh

Confirm the combined row count equals the sum of the file row counts. Drop a new file into the folder and click Data, Refresh All to confirm it appears in the table.

Worked example: synthetic folder of twelve monthly files

The table below is a synthetic example. It shows the expected result of combining a folder; no files were imported.

Check Count Result
Files in the folder 12 Source
Rows per file 30 Same layout
Combined rows 360 12 times 30
New file after Refresh 1 Appears in the table

Expected result (UNTESTED). 12 files of 30 rows each combine into one table of 360 rows, and a new file dropped into the folder appears after Refresh. This check was not run live; the table shows the expected result for the synthetic example.

Limits

  • A file with a moved column breaks the shared steps; the layout must be identical.
  • Scanned files in the folder still have no text to read.
  • Keep the folder clean: only files that belong in the combined table should be in it.

Sources

See all