Why a text diff isn’t enough for CSV
Run two CSV exports through diff or a text comparison website and you get changed lines. That breaks down quickly:
- If the exporting system sorts differently this time, almost every line differs.
- If a column was added or moved, every line differs.
- A changed line tells you something in that row changed; on a 40-column export you then have to find which field by eye.
- Quoting differences (
"Smith J"againstSmith J), trailing spaces and4.5against4.50all count as changes.
RowDiff parses both files as tables first. Columns are matched by header name, so column order doesn’t matter. Rows are matched by a key column you pick (an order ID, a SKU, an email), or aligned in order when there isn’t one. Then each field is compared, and only the fields that really changed are marked.
How to compare two CSV files
- Drop the older CSV on A and the newer on B. Comma, semicolon, tab and pipe separators are detected from the file;
.csv,.tsvand.txtall open. - Check that First row is headers is ticked if your files have a header row. Without headers, columns are matched by position and named A, B, C…
- Choose the key column under Match rows by. With a key, the order of rows in either file stops mattering.
- Tick Ignore extra spaces and Ignore case if exports pad or re-case values, and set a number tolerance if amounts are rounded differently.
- Read the result, or download the differences as CSV for the next step in your pipeline.
What RowDiff does with CSV values
- Everything is read as text first, so leading zeros (
007), long ID numbers and date strings are never altered, unlike opening a CSV directly in Excel, which can strip zeros and reinterpret dates. - Plain numbers compare as numbers:
4.5,4.50and4.5e0are equal. Numbers with thousands separators (1,234) are compared as text. - Encoding: UTF-8 (with or without a byte-order mark) is read as UTF-8; files that aren’t valid UTF-8 are read as Windows-1252, which is what older Excel CSV exports use, so accented names come through.
- Blank lines are skipped.
The CSV of differences
The export has one line per differing row: status (Changed, Added or Removed), the row number in each file, the key, the list of changed columns, then two columns per field, Price (A) and Price (B). That shape loads cleanly into Excel, a database or a script, and you can filter on the status column. Text that begins with =, + or @ is written with a leading apostrophe, so a spreadsheet shows it as text rather than running it as a formula.
Comparing a CSV with an Excel file
You can put a CSV on one side and an .xlsx on the other. This is a common check after an import or a migration: does the system’s CSV export still match the workbook it was loaded from? Numbers and plain text compare as you’d expect; dates are the one thing to watch, because a CSV holds a date as text and Excel holds it as a number, so compare them as text in both or expect them to show as changed.
Related: Compare two Excel files for differences · Reconcile two lists · Compare two Excel sheets