Excel Merge Files With the Same Header
Yes. You can merge Excel files that have the same header by stacking their data rows into one worksheet; Power Query is usually the best built-in option when you have several files or expect to repeat the task. Put the files in one folder, combine them, and check that the resulting columns and row counts are correct.
What “same header” means
A header is the row of column names, such as Date, Order ID, and Amount. When files share the same header and the same meaning and order for each column, merging generally means appending the rows from one file below the rows from another. It does not mean joining records side by side based on a matching value; that is a different operation called merging or joining queries.
Matching column names are helpful, but they are not enough by themselves. For example, one file might use Amount for dollars and another for quantities, or one might store dates as text. Verify that the columns represent the same information and use compatible data types before combining.
Use Power Query to combine files in a folder
Power Query can import multiple workbooks from a folder, apply a consistent transformation, and append their rows into one result. The precise labels and available commands can vary by Excel edition and platform, but the general workflow is:
- Copy the source workbooks into a dedicated folder. Keep unrelated files out of it, and make sure each workbook has the data on a consistent worksheet or table structure.
- In Excel, open the Data tab and choose the option for getting data from a folder. In many desktop versions, this is under Get Data and From File.
- Browse to the folder and review the file list. Choose the combine or transform option, then select the worksheet or table that contains the data when prompted.
- Inspect the sample and resulting query. Confirm that the header row is recognized as column names, not included as a data record.
- Choose Close & Load or the equivalent command to put the combined result into Excel.
Power Query normally uses one file as a sample to determine how to interpret the others. This is convenient when all files follow the same layout, but it means a file with a different sheet name, extra title rows, or a changed structure can produce missing or misaligned data. Review the combined output rather than assuming that a successful import proves every row is right.
Append data already in Excel
If the data is already in separate Excel tables or queries, use Power Query’s append operation. In the query editor, choose the append command, select two tables or queries—or the option for three or more—and specify the sources. The result stacks rows into a new query.
Append matches columns by their names, not simply by their position. If one source calls a field Customer ID and another calls it Client ID, Power Query can create separate columns, leaving blanks where a source has no matching field. Rename equivalent fields consistently before appending. Conversely, columns that exist in only some files can remain in the result, with blank values for records from files that lack them.
For a one-off job with only a few small files, copying rows below the existing header may be quicker. Copy only the data rows from each additional workbook, not its header, and paste them beneath the first file’s data. This manual method is easy to understand but is more vulnerable to skipped rows, duplicated rows, and accidental changes.
Check headers, data types, and duplicates
Before relying on the combined sheet, check the details that most often cause quiet errors:
- Headers: Each source should have one clear header row. Remove title lines, blank rows, and repeated headers within the data before appending.
- Column names: Standardize spelling, spaces, punctuation, and naming before combining. Similar-looking labels are not always treated as identical.
- Data types: Check dates, numbers, and identifiers. A value such as 00127 may need to remain text if the leading zeros are meaningful; converting it to a number changes it to 127.
- Row counts: Compare the total output rows with the sum of the source data rows, allowing for any rows you intentionally removed during cleanup.
- Duplicates: Appending does not automatically remove duplicates. Decide whether repeated records are valid; if not, define which columns identify a duplicate before removing any.
One common misconception is that “same header” guarantees a clean merge. It guarantees neither identical data types nor identical meanings. A column called Date could contain day/month/year text in one file and month/day/year values in another. Inspect ambiguous dates and numeric formats before analysis, especially when files come from different systems or regions.
Refresh and maintain a folder-based merge
A folder query can make recurring work easier. When new files with the expected structure are saved in the folder, reopen the workbook and refresh the query to include them. The query can also preserve transformation steps, such as removing blank rows or setting a column’s type.
For dependable refreshes, keep source files separate from the workbook containing the query, use a consistent template, and avoid changing worksheet names or header labels without updating the query. If the output seems incomplete, check that the new file is in the correct folder, uses the expected worksheet or table, and is not a temporary or unrelated workbook. Refreshing can also repeat previously imported records if old files remain in the folder, so manage the folder contents intentionally.
When to choose another method
Choose the approach based on how much data there is and whether the task will recur:
- Power Query from a folder: Best for many workbooks with a consistent layout, especially when you will add files and refresh later.
- Append existing queries: Useful when each source is already imported or transformed and you want one combined query.
- Copy and paste: Reasonable for a small, one-time combination when you can verify the rows manually.
- Join or merge queries: Use this instead when you need to match records using a shared key, such as an order number, rather than stack records vertically.
Excel’s worksheet row limit also matters for very large combinations: a worksheet supports up to 1,048,576 rows. If the combined data exceeds what a sheet can hold, keep it in a data model or use a database or other suitable data tool rather than trying to load every row onto one worksheet.
Frequently Asked Questions
Can Excel combine multiple files with the same headers automatically?
Yes. Use Power Query’s folder import and combine workflow. It can append data from compatible files and can be refreshed when the folder’s contents change.
Do the columns have to be in the same order?
Not necessarily when appending Power Query tables: columns are matched by name. Still, standardize the names and inspect the output so fields with different meanings do not get combined or split unexpectedly.
Will Excel remove duplicate rows when I merge files?
No. Appending keeps repeated rows unless you explicitly remove duplicates. Decide what counts as a duplicate before using a remove-duplicates command.
Why do I see extra columns or blank cells?
Sources may have different column names or some files may omit fields. Power Query can treat differently named fields as separate columns and leave blanks where a source has no value for a column.
Can I merge files with different headers?
Yes, but first map equivalent fields to consistent names and decide how to handle columns found in only some files. Otherwise, the combined table may contain separate columns for the same concept.
Related
Method: the standard formula for this calculation, rounded as each result states. See how the calculators work or report an error.