How to combine multiple Excel files into one sheet
30 November 2026
To combine several Excel files into one sheet, stack each file's rows under a single heading row: copy and paste them for a few files, or use Power Query's From Folder in Excel for Windows, which combines every file in a folder and refreshes when new ones arrive. Check the columns first: if the files have them in a different order, copying and pasting puts values under the wrong headings.
Before you start: check the columns
Open two or three of the files and compare their heading rows.
- Same headings, same order: any method below works.
- Same headings, different order: copying and pasting, and most simple macros, stack columns by position, so one shop's Sales can land under another's Date. Power Query matches by heading instead.
- Different spellings or extra columns: "Date" and "date" are different headings to Power Query, and a column that's only in some files can go missing. Rename headings to match before combining.
Once the rows are stacked, you can't tell which file each came from unless something records it.
1. Copy and paste
Good for: a handful of files with identical layouts.
- Open a new workbook for the combined sheet.
- Open the first file, select its data including the heading row, copy it and paste it into A1.
- Open the next file, select its data without the heading row, and copy it.
- In the combined sheet, click in column A and press Ctrl+Down arrow (Cmd+Down arrow on a Mac) to reach the last filled row, then paste into the row below.
- Repeat for each file. If you need to know where rows came from, type the file name in a spare column next to each block.
It works anywhere, including on a Mac, but it stacks by position, it's easy to miss a file, and you start again next month.
2. Power Query: From Folder
Good for: files that arrive every week or month, in Excel for Windows.
- Put the files in one folder with nothing else in it.
- Choose Data > Get Data > From File > From Folder, pick the folder and choose Open.
- In the list of files, choose Combine > Combine & Transform Data.
- In Combine Files, choose the sheet or table to take from each file and choose OK.
- Check the result in the Power Query Editor, then choose Home > Close & Load.
The combined sheet includes a Source.Name column with each row's file name. Next time, add the new files to the folder and choose Data > Refresh All.
Three things catch people out. Microsoft's guide to importing from a folder explains the sample file behind them.
- Sheet names must match. Power Query looks for the sheet you chose in step 4 by name in every file. A file whose sheet is called "Sheet1" instead of "Leeds" stops the query with the error "The key didn't match any rows in the table".
- The column list comes from the sample file. That's the first file unless you pick another under Sample File in step 4. Columns are matched by heading, so their order doesn't matter, but a column that's only in other files is left out.
- Headings are case-sensitive. If the sample file says "Date" and another file says "date", that file's dates come out blank.
On a Mac, Microsoft's list of Power Query sources shows a local folder for refreshing an existing query, not for importing a new one, so build the query on Windows.
3. Use a VBA macro
Good for: a one-off combine on Excel for Windows, when the files have the same columns in the same order.
This macro opens every .xlsx file in a folder and stacks the rows of its first sheet onto the sheet you're on, keeping the heading row once. It copies values only, so nothing links back to the source files. Start from an empty sheet in a workbook kept outside that folder, press Alt+F11, choose Insert > Module, paste the code, change FOLDER and press F5.
Sub CombineFiles()
Const FOLDER As String = "C:\Reports\" ' the folder, ending in \
Dim target As Worksheet, src As Workbook, data As Range
Dim fileName As String, nextRow As Long
Set target = ActiveSheet
nextRow = 2
Application.ScreenUpdating = False
fileName = Dir(FOLDER & "*.xlsx")
Do While fileName <> ""
Set src = Workbooks.Open(FOLDER & fileName, ReadOnly:=True)
Set data = src.Worksheets(1).Range("A1").CurrentRegion
If target.Range("A1").Value = "" Then ' first file: copy its heading row
target.Range("A1").Resize(1, data.Columns.Count).Value = data.Rows(1).Value
End If
If data.Rows.Count > 1 Then ' then everything below the headings
Set data = data.Offset(1).Resize(data.Rows.Count - 1)
target.Cells(nextRow, 1).Resize(data.Rows.Count, data.Columns.Count).Value = data.Value
nextRow = nextRow + data.Rows.Count
End If
src.Close SaveChanges:=False
fileName = Dir
Loop
Application.ScreenUpdating = True
End Sub
It stacks by position, so it has the same problem as copy and paste when columns are in a different order. It expects each file's headings in row 1 with no blank rows or columns in the data, doesn't record which file each row came from, and doesn't copy formatting.
When the columns really don't match
If people use different headings for the same thing, such as "Qty" and "Quantity", no method can safely guess they match. Rename the headings before you combine, and send everyone a template so next month's files match.
When a tool is quicker
Copying and pasting is fine for three tidy files. For twenty, each with its columns arranged differently, it's slow and mistakes are hard to spot.
That's why we made Combine Sheets. Drop in the files, or a whole folder, in any mix of .xlsx and .csv, and tick the sheets to include. Columns are matched by their heading whatever their order, ignoring capitals, so "Date" and "date" end up together; if the headings differ but the layout is the same, you can match by position instead. A column that's only in some files gets its own column and is flagged, so nothing is dropped. Every row is labelled with the file it came from, and you see a preview before you download one sheet as an Excel workbook or a CSV file. Dates stay dates and numbers stay numbers, but each file's own colours and fonts aren't carried over. Older .xls files need saving as .xlsx first.
It runs in your browser, on Windows or Mac, and your files never leave your computer. The free version combines up to 10 files at a time; Pro is £19 once and combines any number. You can try it with sample files first. If your files are all CSVs, see how to merge CSV files, and for tabs within one workbook, how to combine sheets into one.
Quick answers
How do I combine Excel files with columns in a different order? Match the columns by heading rather than position. Power Query's From Folder does, as long as the headings are spelt the same, with the same capitals, and the sample file has every column.
Can I combine Excel files on a Mac? Copy and paste works. Excel for Mac can refresh a folder query made on Windows but doesn't list a folder as a source for a new one, so on a Mac it's copy and paste or a tool that runs on a Mac.
How do I keep track of which file each row came from? Power Query adds a Source.Name column. When you copy and paste, add a column with the file name yourself as you go.