ModernCalcs

CSV Merger

name,age,city
Alice,30,New York
Bob,25,Chicago
Charlie,35,London
Diana,28,Sydney

Column-name alignment handles CSVs with different column orders. Missing columns are filled with empty fields.

CSV Merger: Combine Multiple CSV Exports into One File

Monthly reports, paginated exports, regional data files — the same schema repeated across multiple CSV files that need to be combined for analysis. This merger handles the tricky case where CSVs have the same columns in different orders (column-name alignment), missing columns, or different headers — and lets you control exactly how header rows are handled.

Formula
CSV A: name,age,city CSV B: name,city,age Alice,30,NYC Bob,LA,25 Merged (column-name alignment): name,age,city Alice,30,NYC Bob,25,LA ← city and age swapped to match header order

Column-name alignment produces a union of all headers. Missing values become empty fields. Position alignment requires identical column order.

Column-Name vs Position Alignment

Use column-name alignment when your CSVs might have columns in different orders (common with exports from different systems or time periods). The output uses the union of all column names, ordered by first appearance. Use position alignment when you know all CSVs have identical column structure and you want maximum speed without header parsing.

Header Row Strategies

For identical-format CSVs: use 'Include once (from first CSV)' — this is the most common case when merging monthly reports. For heterogeneous CSVs with different structures: 'Include from each CSV' preserves each file's headers, useful when you want to see which file each block came from. For no-header output (re-headering later): 'Skip all headers' produces pure data rows.

Common Use Cases

Monthly report stacking: merge January.csv, February.csv, March.csv into Q1.csv with one header row. Regional data: combine sales data from North, South, East, West regions where some regions have different extra columns. Paginated exports: some APIs export 10,000 rows per file — merge all pages into a single file for analysis.

Merger Capabilities

  • Add unlimited CSV inputs
  • Column-name alignment with union of headers
  • Missing columns → empty fields
  • Position alignment for identical-format CSVs
  • Three header-row modes: once, all, none

Frequently Asked Questions

What is the difference between column-name and position alignment?

Column-name alignment uses the header row to match columns — if CSV A has columns [name, age, city] and CSV B has [name, city, age], they are aligned correctly by name rather than position. Position alignment ignores headers and concatenates rows by column position — column 1 of every CSV goes into column 1 of the output, regardless of header labels.

How are missing columns handled in column-name mode?

If CSV A has a column that CSV B does not, rows from CSV B will have an empty field for that column in the output. The output includes the union of all column names from all CSVs, with empty cells where a particular CSV has no data for that column.

Can I merge more than two CSVs?

Yes. Click 'Add CSV' to add additional input boxes. You can merge as many CSVs as you need — all will be combined into a single output. Empty inputs are ignored.

How is the header row handled?

Three modes: 'Include once (from first CSV)' — adds the header from the first CSV and skips headers from subsequent CSVs (best for identical-format CSVs). 'Include from each CSV' — adds each CSV's header row in the output (use when concatenating files with different structures). 'Skip all headers' — omit all header rows (use when the output will be re-headered elsewhere).