How to Merge CSV Files by a Common Column
You have an orders file and a customers file. You need the customer's name, region, and email next to each order. Both files share a customer ID column. In Excel, this is VLOOKUP territory — and VLOOKUP has a well-earned reputation for breaking the moment the underlying data changes.
This guide covers doing that join reproducibly: define it once, re-run it on every new export, and get identical results every time.
Note: if you want to stack multiple files row by row into one table, that is a different operation — see how to combine and append CSV files.
Why VLOOKUP struggles with recurring files
- The lookup column must be leftmost — or you're writing INDEX-MATCH instead.
- Column positions shift. A new column inserted upstream breaks the column-index number silently, returning wrong data without an error.
- It's not portable. Next month's export means rebuilding the formula from scratch.
- Performance degrades on large files. Dragging VLOOKUP down 100,000 rows makes Excel slow to recalculate.
The join model: pick a key, pull the columns
The mental model for key-based merging is simpler than VLOOKUP once you see it:
- Open your primary file (e.g.
orders.csv). - Add a Merge from another file step and select the secondary file (
customers.csv). - Pick the matching columns:
orders.CustomerIDmatchescustomers.ID. - Choose which columns to pull across: Name, Region, Email.
- Decide how to handle non-matches: keep all rows with blanks for unmatched, or keep only matched rows.
Do it with Kramata
Kramata treats the merge as a step inside a recipe. You build it once on a sample file, save it, and next month load the new export and click once. No formulas, no broken references, and your files never leave your computer.
- Reproducible: same files + same recipe = identical output, every time.
- Batch-ready: apply the merge across a whole folder of primary files at once.
- Fast on large files: matched through an in-process database, not a formula dragged down row by row.
For a full walkthrough including left vs. inner join behavior and handling unmatched rows, see merge two spreadsheets without VLOOKUP.
Related guides
Merge two spreadsheets without VLOOKUP · Combine and append CSV files without losing data · Merge multiple CSV files into one · A simple Power Query alternative
FAQ
What if the key column has a different name in each file? You pick which column from each file to match on — the names do not need to be identical across files.
What happens to rows with no match? Your choice: keep them with blank values for the pulled columns (a left join), or drop them (an inner join). Both options are set once in the recipe.
Can I match on more than one column? Single-key matching today; multi-key is on the roadmap.
Is this the same as Power Query's Merge Queries? Same idea — a join between two tables on a common key — in plain language, built for non-technical users. No M code required.
Is this different from appending files? Yes. Merging by a column joins two files horizontally — pulling new columns from a second file to match rows in the first. Appending stacks rows from multiple files with the same structure vertically into one table.
What if the secondary file changes next month? Re-running the recipe re-reads the secondary file fresh — so the merge automatically reflects any updates to it.