data tool

Merge CSV files

Choose two or more CSV files and get one combined file, with columns matched by their header names rather than their positions, so files whose columns are in a different order, or that gained a column partway through, still line up. Everything is merged inside this page.

Loading the tool…

How it works

  1. 1

    Choose the files

    Select two or more CSVs at once. Up to 50 are read.

  2. 2

    Keep or drop the source column

    A source_file column records which file each row came from, which helps when checking the result.

  3. 3

    Remove duplicates if needed

    Pick a column such as email to drop rows whose value already appeared, or keep every row.

  4. 4

    Check the report and download

    The report lists each file's rows and missing columns; then download merged.csv.

Matching by header name

Copying one CSV under another works only if every file has the same columns in the same order. Real exports drift: a column is added in March, two are swapped by a software update, a heading gains a capital letter. This tool reads each file's header and places every value under the matching column in the combined file, ignoring capitals and stray spaces. Columns are ordered as they first appear, starting with the first file, and any column a file lacks is left blank for that file's rows.

Merging monthly exports that gained a column

The common case is a set of monthly response exports from one form, where a question was added partway through the year. The early files lack that column; the later files have it. Merged by name, the early rows simply show the new column blank, and the report lists which files lacked it, so a reader of the combined data knows the blanks mean not asked rather than not answered. The source_file column makes the month of every row visible.

Removing duplicates while merging

When the same person appears in two files, a duplicate check on a key column such as email keeps the first occurrence and drops the rest. Matching ignores capitals and surrounding spaces, so Ann@Example.com and ann@example.com count as the same. Rows with a blank key are always kept. The summary says how many duplicates were removed. Merge the files in the order you trust them, newest first if the latest details should win, because the first row seen is the one kept.

Combining two different forms

Responses from two forms with some questions in common can be merged too. Questions with identical wording end up in one column, and the rest sit in their own columns, blank for the other form's rows. For a cleaner result, edit the header rows so shared questions use the same heading before merging. The form builder exports each question as a column headed by its label, so consistent labels across forms make later merging simple.

Checking the merged file

Read the report before using the result. Rows per file should add up to the merged total, plus any duplicates removed. A column that is missing from most files is often a heading that was renamed, such as Phone in some files and Mobile in others; rename the headers to match and merge again so the values end up in one column. Then open the merged file in the CSV to table tool to sort and spot check it.

What merging cannot do

Merging stacks rows; it does not join two tables side by side by a shared key, such as adding a phone number from one file to the matching customer in another. That is a lookup or database join, which spreadsheet functions like XLOOKUP handle. Merging also does not reconcile different spellings of the same value, so tidy those first if they matter for your analysis.

Large merges

All the files are read into memory together, so the combined size is limited by the device. Dozens of files of a few megabytes each merge quickly. If a merge of very large files stalls, merge them in groups and then merge the results, which gives the same file.

Limits

  • Every file needs a header row; columns are matched by name, ignoring capitals and surrounding spaces.
  • Delimiters are detected per file, so a comma file and a semicolon file can be merged.
  • Duplicate removal keeps the first row seen with each key and drops the later ones.
  • The merged file is written with commas and UTF-8, without a byte order mark.

What it does not do

  • It does not join files side by side on a key, as a database join would.
  • It does not change values or types.
  • It does not upload the files.

Questions people ask

How do I combine several CSV files into one?

Choose all the files at once here, keep the source column on, and press Download. Columns are matched by their header names, so the files do not need identical layouts. The combined merged.csv has every column that appears in any file.

What if the columns are in a different order?

That is handled automatically. Each value is placed under the column whose header matches, ignoring capitals and spaces, so a file with Name, Email and another with Email, Name line up correctly. Only the header names need to match; the order and the number of columns can differ from file to file.

Can I remove duplicate rows while merging?

Yes. Choose a column, usually an email address or an ID, in the remove duplicates list. The first row with each value is kept and later rows with the same value are dropped. The summary reports how many were removed, and rows with no value in that column are kept.

Why are some cells blank in the merged file?

Those rows came from files that did not have that column. The report under the summary lists each file and the columns it lacked, so a blank in, say, a phone column for the January file means January's export had no phone column, not that people left it empty.

Is there a limit on how many CSV files I can merge?

Up to 50 files in one go. The real limit is memory, since every file is read together in the browser before the merged file is written. For more files than that, merge them in batches, then merge the batch results, which gives exactly the same combined file.

Start one form so there is one export

Take what you made here into forms.

Create a form with OneCraft

More tools like this

Sources

Written and checked by the OneCraft team. Last checked .