Practical guide

How to merge CSV files with mismatched columns

Choose strict validation or a deterministic union without shifting data into the wrong headings.

Never merge rows by position when headers differ

If January is id,name and February is name,email, appending raw rows would place February names under id. Header-aware merging prevents this silent corruption.

Use strict mode for a stable export contract

Strict mode requires the same headings in the same order. It is appropriate for monthly exports expected to share a schema; a mismatch is a signal to fix the source.

Use union mode for intentional evolution

Union mode builds a header from the first appearance of each exact column name and aligns every row by that name. Missing fields become empty.

Example: id,name plus id,name,region becomes id,name,region. Existing rows receive an empty region, while the newer rows keep it.

Normalise deliberately

Name and name are equal; Name and name are not. The tool avoids fuzzy matching because automatic case or punctuation changes can combine unrelated columns. Rename sources explicitly when they mean the same thing.

Use the relevant tools

Merge CSV Files

These guides are general information, not legal, security or records-management advice. Follow your organisation’s policies for sensitive files.