File conversion

How to merge multiple CSV files into one

Combine many CSV or Excel files into one table, even when their columns are in a different order. Free, in your browser, with a column showing each source.

DealMahal team · Published 6 December 2026 · 5 min read

To merge several CSV files into one, open our free Merge CSV tool, drop in all the files at once and download the result. Columns are matched by their header name, so the files do not need the same column order, and an optional source_file column records where every row came from. Everything runs in your browser; nothing is uploaded.

The problem with copy and paste

Stacking files by hand works for two small files with identical layouts. It breaks when:

  • one export has Email, Name, Phone and the next has Name, Phone, Email;
  • a newer export added a column such as Country;
  • there are 30 monthly files, not two;
  • the header row gets pasted again in the middle of the data.

The tool avoids all four, because it reads each file's header and never pastes anything.

Step by step

  1. Open Merge CSV.
  2. Choose or drop all the files at once. You can add more files afterwards, up to 50 in total, each up to 50 MB. CSV, TSV, TXT, XLSX, XLS, ODS and JSON files can be mixed.
  3. Leave Add a first column "source_file" with the file each row came from ticked if you want to trace rows back. Untick it for a clean table.
  4. Check the preview (first 100 rows; the download has all of them).
  5. Download as CSV, Excel or JSON.

How the columns are lined up

The tool builds one list of columns as it reads the files, in the order it first meets them.

  • Same name, any order: Email in file 1 and Email in file 3 go into the same column.
  • Case and edge spaces are ignored when matching: email, Email and EMAIL are treated as one column. The spelling from the first file that had it is used as the header.
  • New columns are added, not dropped: if only the March file has Country, the merged file has a Country column, filled for March rows and blank for the rest.
  • The header appears once, at the top.

Here is what that looks like with two small files:

january.csv

EmailName
ana@example.comAna

february.csv

NameEmailCountry
Benben@example.comIN

Merged result

source_fileEmailNameCountry
january.csvana@example.comAna
february.csvben@example.comBenIN

Note what is not matched: E-mail and Email are different names, so they become two columns. Rename headers to match before merging if your sources spell them differently.

Files with different separators or encodings

Each file is read on its own terms. The separator is detected per file from comma, tab, semicolon and pipe, so a semicolon file saved by Excel in Germany and a comma file from a web app can go into the same merge. The text encoding is detected per file too: UTF-16 when the file starts with a UTF-16 marker, otherwise UTF-8, falling back to Windows-1252 for older exports that are not valid UTF-8. The merged CSV is written as UTF-8 with a byte order mark, so accented names from every source open correctly in Excel. JSON files are flattened the same way as in our JSON to CSV converter, so nested fields arrive as dotted column names.

Headers that need a look first

The first non-empty row of each file is taken as its header, and completely empty rows are skipped. Three cases to check before you merge:

  • A title row above the header, such as "Sales report, March", becomes the header for that file, and its columns will not line up with the others. Delete it first.
  • Empty header cells are named by position, such as column_4, and only match a column_4 in another file.
  • A name repeated inside one file gets a number, such as Email_2, so both columns are kept.

Merging Excel workbooks

Excel files can go into the same merge as CSVs. Every sheet in a workbook that has data is included, and the source_file column shows both the file and the sheet, for example sales.xlsx (March). If you only want one sheet, convert that sheet to CSV first with Excel to CSV, then merge the CSVs.

After merging: remove duplicates

Merging keeps every row. If the same customer or company appears in two exports, you will see them twice. Run the merged file through Remove duplicates and compare on the column that identifies a record, such as Email. The first row wins, which means the file you added first wins, so add your most trusted export first. Our guide to removing duplicates based on one column explains the options.

Limits to know

LimitValue
Files per merge50
Size per file50 MB
Columns2,000
Rows in one Excel sheet1,048,576 (download CSV or JSON if the merge is bigger)

Other ways to do it

  • Command line: on macOS or Linux, joining files with a shell command is quick when every file has identical columns, but it repeats the header row from every file and does not line up columns that are in a different order.
  • Excel Power Query: Data > Get Data > From File > From Folder combines every file in a folder and can be refreshed. Microsoft documents it in Combine CSV files. It is the right choice if you repeat the same merge every month inside one workbook.
  • Our tool: best for a one-off merge of mixed files, without installing anything and without sending the data anywhere.

Frequently asked questions

Do my CSV files need the same columns in the same order?

No. Columns are matched by header name, not position, ignoring upper and lower case and spaces at the ends. A column that exists in only some files is kept, and left blank for rows from the other files.

How many files can I merge at once?

Up to 50 files, each up to 50 MB. They can be a mix of CSV, TSV, TXT, XLSX, XLS, ODS and JSON.

Can I tell which file each row came from?

Yes. The source_file column is on by default and shows the file name for every row. For workbooks with several sheets it also shows the sheet name.

Does merging remove duplicate rows?

No. Every row from every file is kept. Run the merged file through the Remove duplicates tool afterwards if you need unique rows.

Are my files uploaded?

No. The merge runs in your web browser on your own computer.

Spotted an error? Write to dealmahal.official@gmail.com.

Questions or corrections: dealmahal.official@gmail.com.

Keep reading

All posts