SPARKPOND / GUIDE
How to Compare Two CSV Files by a Key
A stable key lets rows move without looking changed and connects old and new versions for field comparison.
Problem symptoms
- Row-by-row diffs report many false changes.
- You need an audit of a supplier update.
Why it happens
- Rows were sorted differently.
- Records were added or removed.
- One field changed under the same identifier.
Example before and after
Before
old: A,10 / B,20 new: A,12 / C,30
After
changed A / removed B / added C
Procedure
- Choose a unique stable key.
- Resolve duplicate keys.
- Select compared columns.
- Review and export change groups.
Common mistakes
- Using row number as identity.
- Ignoring duplicate keys that multiply matches.
Other possible solutions
- Use a version-control diff for small, consistently sorted text files.
Important limitations
- No reliable key means some matches remain ambiguous.