novair Back to Novair Sheets
Novair SheetsCSV and Excel

How to compare two CSV files for differences

Two exports of the same table, a month apart: what was added, removed and changed? A line-by-line diff answers badly as soon as one row moves. Matching the rows by a key answers exactly.

Why a text diff is not enough

A text diff compares line 1 with line 1. Insert one order at the top of the second file and every line after it looks changed. Sort the export differently, or let Excel write 1,106.97 where the CSV had 1106.97, and the diff is full of noise that hides the three cells that really changed.

What you want is the database answer: take a column that identifies a row (an order number, a customer id), find each key on both sides, then compare the other columns of the matched rows.

A real example

The two sample files that come with the extension: orders-october.csv (1,200 orders) and orders-november.xlsx (1,225 orders). Here is the same order in both, with the header:

order_id,order_date,customer,contact_name,email,country,status,items,amount,delivery_date
SO-105088,2026-10-03,Juniper Rail,Erik Nyström,erik.nystrom@juniper.example.com,SE,Delivered,10,1229.97,2026-10-07
SO-105088,2026-10-03,Juniper Rail,Erik Nyström,erik.nystrom@juniper.example.com,SE,Delivered,10,"1,106.97",2026-10-07

Matched on order_id, the two files give 37 added, 12 removed, 58 changed (70 changed cells: 31 amounts, 22 statuses, 17 delivery dates) and 1,130 identical. For SO-105088 the amount column shows 1229.97 → 1106.97: one value, written the same way on both sides, whatever the Excel format.

Compare by key in VS Code

  1. Open the first file in Novair Sheets (right-click, Open in Novair Sheets).
  2. Click Compare and choose the second file: CSV, TSV, Excel or Parquet, in any mix.
  3. Check the suggested key. Unique on both sides means each key appears once on each side; otherwise the panel says: “Not unique: 3 duplicate keys. Rows with the same key are matched in file order.”
  4. Read the cards (added, removed, changed) and the list of rows; each changed cell shows its old and new value.
  5. Export the report in HTML, CSV or Excel and attach it to the ticket (Pro).

Match two tables by key (1 to 3 columns), even CSV against Excel or Parquet: every added, removed and changed row, and each changed cell, with a numeric tolerance and columns you can ignore or pair by hand. Free, the same window counts what a key match would find on your own files; Pro shows which rows and cells. To try all of it with no key, run “Novair Sheets: Try Compare on Sample Files”.

On the command line

For two files with the same columns and the same formatting, sorting and diffing works and shows whole lines:

diff <(sort orders-october.csv) <(sort orders-november.csv)

With Python, pandas can match by key and tell you which side each row comes from:

import pandas as pd
a = pd.read_csv('orders-october.csv', dtype=str)
b = pd.read_excel('orders-november.xlsx', dtype=str)
m = a.merge(b, on='order_id', how='outer', indicator=True, suffixes=('_oct', '_nov'))
print(m['_merge'].value_counts())

Both are fine for a one-off. They do not show which cell changed, and the Excel side comes back as text formatted by Excel unless you clean it first.

Common pitfalls

  • Duplicate keys: two rows with the same order number cannot be matched one to one. Novair Sheets says so before comparing (“3 duplicate keys: rows with the same key are matched in file order.”); a key of two or three columns often makes it unique.
  • Dates written differently: 2026-10-03 on one side, 10/03/2026 on the other. Some dates are not written the same way on both sides (orders-october.csv: 2026-10-03, orders-november.xlsx: 10/03/2026). Dates are compared as written.
  • Leading zeros lost: a file opened and saved again in a spreadsheet turns 00412 into 412. Compare the files as exported; when you edit a CSV in Novair Sheets, saving keeps leading zeros.
  • Rows in another order compared by position: every row looks different. Novair Sheets notices it: “The rows seem to be in a different order. Matching them by order_id would show what was added, removed and changed.”
  • Rounding: 10.1 against 10.10000001 is a change for a strict comparison. Set a numeric tolerance, or ignore the column.

Frequently asked questions

Can I compare a CSV file with an Excel file?

Yes. Either side can be CSV, TSV, PSV, XLSX, XLSM, XLS, ODS or Parquet; numbers are compared as numbers, whatever the Excel format.

What is free and what needs Pro?

Compare two tables by position (row 1 with row 1, and so on): counts of identical and different rows; Pro shows which ones. On your own files, see how many rows a key match would find added, removed and changed, before you buy; Pro shows which ones, cell by cell. Pro shows the rows and cells, saves the report and makes anonymized copies.

Are my files sent anywhere?

Your files never leave the computer that reads them: no file data is sent. The only network call is the licence check: activation needs one connection to api.gumroad.com from that computer (in a Remote-SSH, WSL or dev container window, the remote computer), through your VS Code proxy settings; after that, Pro works offline. Without a licence key, the extension makes no network call.

Compare your own two exports this way

Novair Sheets for VS Code opens CSV, TSV, Excel and Parquet files in one grid, on your machine, with the row and column count in view. Free, no account, no banner; Pro compares two tables by key and saves the report.