CSVians AI / Guides

Merge & compare CSVs

Combine files on a stable key, or see exactly what changed between two versions.

Two different jobs

Merging stacks or joins two files into one. Comparing shows what changed between two versions of the same file. They need different rules, so say which one you want.

Merging: align before you combine

  1. Check the columns match. “Region” in one file and “region_name” in the other will not join until you map them.
  2. Stacking (union). Same columns, more rows. Watch for different column order and extra columns in one file.
  3. Joining (lookup). Different columns, shared key. State the key and what happens to rows with no match: keep them, drop them, or list them.

Example prompt

“Join orders.csv with customers.csv on customer_id. Keep all order rows, and add the customer's name and region. List any customer_id in orders that has no match in customers.”

Comparing: every change, accounted for

CSVians tracks each row by a stable identity, so the Compare view reports exactly which rows were added, removed or changed between two files — not just a diff of line numbers. This works even when rows were reordered.

Use it to answer: “What did the cleaning tool actually change?”, “Which orders disappeared between Monday's and Tuesday's export?”, “Did any prices change?”

Common traps

  • Key formatting differences. “00123” vs “123” will not match. Normalise the key column in both files first.
  • Duplicate keys. If the key is not unique in one file, a join can multiply rows. Ask for a duplicate-key check before joining.
  • Encoding mismatches. Files from different systems may use different encodings; garbled characters after merging are the symptom.

Verify

After a merge, the output row count should match your expectation (all orders, or only matched orders). After a compare, read the added/removed/changed counts and spot-check a few rows from each group.