How to combine Excel files from a folder with Power Query
In Excel, go to Data > Get Data > From File > From Folder, select the folder, then choose Combine & Load. Power Query builds helper queries from a sample file and stacks every file into one table. It works when all files share the same headers and the same sheet or table name.
Power Query is available in Excel for Microsoft 365, 2024, 2021, 2019 and 2016. The steps below follow Microsoft's article on how to import data from a folder with multiple files:
Power Query adds a column with the source file name (Source.Name). Next month, drop the new files into the same folder and refresh the query.
Power Query reads every file in the folder you select and in any subfolders under it. An old copy left in a subfolder gets combined along with the rest. Microsoft's guide to combining CSV files warns: "Selecting Combine is only recommended when you're certain that the folder contains only the files that you want to combine."
For CSV files in the same folder, the command uses the sample file to guess the delimiter and encoding for all of them. More on that below.
Why does Power Query fail on a real folder of files?
Power Query assumes every file matches the sample file, down to the header text, the sheet name and the row the header sits in. Real folders break this. A trailing space in one header or a title block above the data is enough to make some files fail or land in the wrong columns.
Microsoft's docs state the rule: a combine works "as long as they have the same file type and structure (including the same columns)." Three failures come up often on the Microsoft forums.
Headers that differ by a space or a sheet name
In a Tech Community thread on combining workbooks, the poster traced a broken combine to extra spaces at the start or end of headers in some files. One workbook had a single sheet while the others had several, with different names. The Combine Files dialog accepts one sample object, so files whose sheet has another name drop out or error.A title block above the headers
Many exported reports start with a logo, a report name and a date before the real header row. Microsoft's walkthrough for combining CSV files handles a four-row block. Remove the top rows in the Transform Sample file query. If the output query fails with "The column 'Column1' of the table wasn't found.", delete the last step and set the column types by hand.Docs and forums disagree on column order. An answer in a Microsoft Q&A thread on merging Excel files says the number of columns and their order must be the same in every file. Microsoft's From Folder article says, "The columns do not have to be in the same order as the matching is done by column names." The official article is right about order. The header text must match character for character.
These failures can be fixed inside the Power Query Editor, usually by trimming headers or rewriting a step in M. That is manageable for one analyst and harder to hand over to a colleague who only needs this month's file.
Can a VBA macro combine hundreds of workbooks?
Yes. A macro loops through the folder with Dir(), opens each workbook and copies its rows or sheets into a master file. It runs locally with no file cap. The cost is upkeep: when the folder, the file type or a header changes, someone has to edit the code.
A typical combine macro reads the folder path, lists the files with Dir(), opens each file and pastes its used range under the last row of a master sheet. The Coupler.io version copies whole worksheets to the end of a main workbook instead of stacking rows, which gives one tab per file.
One user in a Microsoft Q&A question about combining hundreds of workbooks hit run-time error 424. A reply traced it to a workbook variable the code used but never assigned with Set.
Pick VBA when someone on the team maintains it and the folder layout is stable. For a one-off batch, or for a colleague who has never opened the VBA editor, Power Query or a desktop combiner is easier to support.
How do you combine CSV files and workbooks in one batch?
Power Query From Folder expects one file type per folder, so CSV and .xlsx files are usually combined in two passes. A desktop combiner that reads both can take the mixed folder in one run, matching columns by header name.
Accounting may export a CSV, a regional office may send .xlsx, and another file may be saved as .xlsm with a macro. Power Query's combine logic assumes "the same file type and structure", so the usual workaround is two queries, one per file type, followed by an append. If the folder holds only CSV exports, our separate guide on how to merge CSV files covers the command-line and PowerShell routes as well.
Why do dates change after combining CSV files?
A CSV file stores dates as plain text. The reader guesses the day-month order from the PC's regional settings or the type Power Query detected from the first file. In one Tech Community thread about a date problem, a Swedish-locale user merging files exported in Germany saw day and year swap places. The accepted fix was to change the column type with Using Locale... and pick the source locale.Before you trust a combined CSV batch, sort the date column and look at the first and last rows. Dates that jump to the wrong year show a swapped order.
What happens when the combined file passes 1,048,576 rows?
An Excel worksheet holds 1,048,576 rows by 16,384 columns. A combine that produces more rows than that cannot fit on one sheet, so either the extra rows are cut or the tool has to split the output. Check the total row count of your batch before you choose "one sheet".
The limit comes from Microsoft's Excel specifications and limits page. Sixty files of 20,000 rows each come to 1.2 million rows. A 32-bit copy of Excel reaches a second limit earlier, since it shares 2 GB of address space with the workbook and add-ins.
Power Query can load a large combine into the Data Model instead of a sheet, though you then work with it in a PivotTable. Our combiner writes up to the limit and then tells you the sheet reached Excel's row limit and the rows past it were not added. When that message appears, switch to One sheet per file or split the folder into two batches.
When is a desktop Excel merger worth it?
Use a desktop Excel merger when the folder mixes CSV and workbooks or the data must stay on the PC. Spreadsheet Compare & Merge Tool for Excel matches columns by header name and ignores case and extra spaces in headers.
Column headers are compared without regard to letter case or leading and trailing spaces, so a "Region " with a trailing space lines up with "region" from another file. A file that lacks a column gets empty cells there. A new column in a later file widens the result. Rows above the header row, such as a report title or a logo line, are left out.
A file that cannot be read does not stop the batch. The program finishes the rest and reports how many files were skipped. In our engine, peak memory is the result plus the largest single input, so a folder of 50 files does not need 50 times the memory.
Two gaps remain. No column records the source file name, and duplicate rows stay. The free trial combines any number of files but writes only the first 50 rows of the result. Output goes to an .xlsx workbook, or to .csv or .tsv for a single sheet. A licensed copy writes the whole table.
Can you combine files without opening them in Excel?
Yes. Power Query reads the folder without opening each workbook, though Excel itself has to run. Our tool reads and writes the files directly, so Excel does not need to be installed on the PC at all.

The start screen shows two cards. Click Combine files to open the merge screen.
Click Add Folder... and select the folder with your reports, or drag files onto the window. Use the up and down arrows to set the order the rows will follow.
Under Merge type, pick Into a single sheet for one long table or One sheet per file for a tab per report.
Under Columns, choose By column name. Tick First row is column names and Keep the header of the first file only.
Spreadsheet Compare & Merge Tool for Excel by SoftOrbits is an Excel file combiner and a comparison tool in one window. It folds a folder of workbooks into a single file, then shows what changed between two versions of a table. The files are read by the program itself. Excel does not have to be installed on the machine that does the work.
What should you check after combining a batch?
Compare the row count of the merge result with the sum of the source files, and note any message about skipped files. A mismatch means a file was missed or read twice. Duplicates need a separate step in Excel.
Every combiner appends. None of the routes in this guide removes duplicate rows by default, ours included. If the same order shows up in two monthly exports, both copies land in the result. In Excel, select the combined table, click Data > Remove Duplicates and tick the columns that identify a record, such as an order number.
To trace a bad row with a desktop combiner or a macro, use One sheet per file. Each tab keeps its file name, so you can find the source before stacking.
When you need to see what changed between last month's combined file and this month's, comparing them is a different job. Our guide on how to compare two Excel sheets walks through that.
For a monthly batch, write the source row counts in a small table next to the result. It takes two minutes and catches a missing file before anyone opens the result.
Sources