Staaarter

CSV File Merger

Merges the data rows of two CSVs into a single output. The default header-aligned union mode matches columns by name across both files, filling any missing column with an empty cell, so files with slightly different column sets still merge cleanly. A free online tool from Staaarter, right in your browser.

Runs locallyUpdated 2026-07-29
By Staaarter Team
multi-filemerge

Overview

Introduction

Combining two CSV exports by hand, in a spreadsheet, means manually copying rows and hoping the columns line up. This tool merges two CSV texts directly, aligning columns by header name so mismatched column sets don't corrupt your data.

It's built for the common case of appending a second export (a new batch of records, a different month's data) onto an existing dataset.

What Is CSV File Merger?

A two-input CSV merger that concatenates the data rows of File A and File B into one CSV, using either header-aligned union (the default) or simple positional stacking.

Header-aligned union computes the union of both files' column names and remaps every row into that shared column order before appending it, so a column present in only one file doesn't shift the rest of that row's values.

How CSV File Merger Works

Both inputs are parsed independently with the same RFC 4180-aware CSV parser used across this category. Their header rows are compared: header-union mode builds one combined header list, then rebuilds every data row (from both files) against that list, using an empty string for any column the row's source file didn't have.

Positional mode skips all of that column-matching and instead just requires both files to have the same column count, then stacks File B's rows directly beneath File A's.

When To Use CSV File Merger

Use it when you've exported the same kind of data twice (e.g. two months of a report) and want one combined CSV.

Header-union mode is the safer default whenever you're not 100% sure both files' columns are in the exact same order.

Often used alongside CSV Comparator, CSV Differ and CSV Cutter.

Features

Advantages

  • Header-union mode tolerates files with reordered, missing, or extra columns without corrupting rows.
  • Positional mode is a simple, predictable pure-append when you know both files match exactly.
  • Runs entirely client-side, so neither file ever leaves your browser.

Limitations

  • Column matching in header-union mode is by exact header text, so a typo or trailing-space difference between the two files' headers is treated as two distinct columns.
  • It does not deduplicate rows that appear in both files.

Header-union vs. positional merge modes

Header-union vs. positional merge modes
ModeColumn requirementBehavior
Header-union (default)None: any overlap worksRemaps every row to a combined column set, filling gaps with empty cells
PositionalSame column count requiredAppends File B's rows directly beneath File A's, unchanged

Examples

Merging two files with different columns

Input

File A:
id,name
1,Ada

File B:
id,email
2,[email protected]

Output

id,name,email
1,Ada,
2,,[email protected]

The merged header is the union of both files' columns; each row fills in an empty cell for whichever column its source file didn't have.

Best Practices & Notes

Best Practices

  • Use header-union mode unless you've already confirmed both files' headers match exactly.
  • Check the output's row count against the sum of both inputs' row counts as a quick sanity check.
  • Run a deduplication pass afterward if the two source files might overlap.

Developer Notes

Header-union mode builds a Map from each source row's own header to that row's values before remapping, rather than assuming positional alignment, which is what lets it merge files whose columns are reordered relative to each other.

CSV File Merger Use Cases

  • Combining two monthly exports of the same report into one file
  • Appending a newly exported batch of records onto an existing dataset
  • Merging CSVs from two systems that use mostly overlapping but not identical column sets

Common Mistakes

  • Assuming positional mode will align columns by name: it doesn't, it only stacks rows, so mismatched column order silently scrambles data.
  • Not noticing that a header typo between the two files (e.g. "Email" vs "email") creates two separate output columns instead of one merged one.

Tips

  • If you expect duplicate rows, pair this with a deduplication tool afterward.
  • Preview both inputs' header rows side by side before merging to catch naming mismatches early.

References

Frequently Asked Questions