Skip to content
freyesperalesPublic

About

SheetDiff — git diff for spreadsheets, in your browser, free: compare two Excel/CSV matched by a key column, nothing uploaded.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

1 Commit

Folders and files

Repository files navigation

SheetDiff

git diff for spreadsheets — in your browser, free.

Drop two Excel/CSV files, pick (or auto-detect) a key column, and get a color-coded report of added / removed / changed rows and cells — matched by key, not by row position. 100% local: nothing is ever uploaded.


Demo

Take a price list, pricelist-v1.csv:

SKU Product Price Stock Supplier
A-1001 Steel Bolt M6 0.12 5400 Acme
A-1002 Steel Nut M6 0.08 5400 Acme
B-2002 Torque Wrench 42.00 45 Bolt Co
C-3002 Cutting Oil 1L 9.40 88 ChemFix
…

Someone sends you pricelist-v2.csv — rows reordered, a couple of prices nudged, one product discontinued, one added. SheetDiff matches by SKU and shows you exactly what moved:

  3 changed · 1 added · 1 removed · 3 unchanged     (7 → 7 rows)

  STATUS     SKU       Product          Price             Stock
  changed    A-1001    Steel Bolt M6    0.12 → 0.14       5400
  changed    A-1002    Steel Nut M6     0.08              5400 → 4800
  changed    B-2002    Torque Wrench    42 → 39.5         45
  removed    C-3002    Cutting Oil 1L   9.40              88
  added      D-4001    Safety Goggles   3.75              500

Changed cells are amber (before → after), added rows green, removed rows red. The reordering produced zero false positives. (Try it yourself with the files in examples/: drop pricelist-v1.csv as A and pricelist-v2.csv as B.)


Run it

Just open index.html in any modern browser. No install, no build, no server.

(The only network request is loading the SheetJS parser from a pinned CDN; your spreadsheet data never leaves the page.)


Why this exists

Analysts, accountants and ops people constantly reconcile v1 vs v2 of a price list, an export, or a budget. The existing options are bad:

  • Microsoft Spreadsheet Compare ships only with Office Professional Plus / Microsoft 365 Enterprise — most people on Home, Business or standard E-plans literally can't open it.
  • Good comparison add-ins cost $30–50.
  • Excel's built-in "View Side by Side" is a manual eyeball exercise.
  • EXACT() / =A2=B2 formulas and VBA macros break the moment rows are reordered, because they compare by position.

SheetDiff's wedge: free, no install, 100% local (so it's safe for confidential financial data), and key-based matching so reordered rows don't show up as spurious changes.


Features

  • Key-based row matching — reorder all you want; identical rows stay "unchanged".
  • Auto-suggests the key column (the column with the most unique values) — or pick your own, including composite (multi-column) keys.
  • Per-cell diff for matched rows, with clear before → after.
  • .xlsx, .xls, .csv, .tsv input; multi-sheet workbooks (choose a sheet per file).
  • Comparison options: numeric tolerance, ignore whitespace, ignore case, and select exactly which columns to compare.
  • Sensible type coercion — "1" (text) equals 1 (number); "100.00" equals 100.
  • Export the diff to CSV and XLSX.
  • Handles large files — the diff runs over every row; the on-screen grid is throttled (first 800 matching rows) so the UI stays responsive, and export always contains everything.
  • No silent failures — duplicate keys are warned about (and never dropped), parse errors are surfaced, empty input is rejected loudly.
  • Reusable engine — the diff logic is a pure, dependency-free JS module (diff-engine.js) shared by the browser UI and the Node test suite.

The engine (for developers)

diff-engine.js is a UMD module — require() it in Node, or load it with a plain <script> tag in the browser (it exposes a SheetDiff global).

const SheetDiff = require('./diff-engine.js');

const before = [{ id: '1', price: '100' }, { id: '2', price: '50' }];
const after  = [{ id: '2', price: '50' }, { id: '1', price: '120' }]; // reordered!

const diff = SheetDiff.diffSheets(before, after, {
  key: 'id',                 // or keyColumns: ['store', 'sku']
  numericTolerance: 0,       // |a-b| <= tol counts as equal
  ignoreWhitespace: false,
  ignoreCase: false,
  // columns: ['price']      // restrict which columns are compared
});

diff.summary;  // { changed: 1, added: 0, removed: 0, unchanged: 1, ... }
diff.rows;     // [{ status, key, a, b, cells: { col: { status, before, after } } }]
diff.warnings; // [{ type: 'duplicate-key' | 'auto-key', message, ... }]

SheetDiff.suggestKeyColumn(rows, columns) returns the best key-column guess.


Limitations (honest)

  • Row-level, flat tables only. It expects a single header row and a rectangular table. Merged cells, multi-row headers, pivot tables and charts are ignored/flattened by the parser.
  • Formulas are compared by their last-computed value, not by the formula text (that's what SheetJS reads from the file).
  • Formatting is not diffed — only values. A cell that changed only its font/color/number-format shows as unchanged.
  • Cell-level matching within a row is by column name. Rename a column and its old/new forms are treated as a removed column + an added column, not a renamed one.
  • Duplicate keys are paired in order of appearance; extras surface as added/removed rows (with a warning). SheetDiff does not attempt fuzzy matching of duplicates.
  • Large-file ceiling is your browser's memory — everything runs client-side. Hundreds of thousands of rows will work but parsing/holding two copies in RAM is the practical limit.
  • CDN dependency for parsing. The spreadsheet parser (SheetJS) loads from a pinned CDN; the diff engine itself is fully offline. For a totally air-gapped setup, vendor xlsx.full.min.js locally and point the <script> tag at it.

Project layout

index.html        self-contained UI (open this)
diff-engine.js    pure diff engine (UMD: Node + browser)
test/
  run-tests.js    zero-dependency test suite
  xlsx-fixture.js builds & parses a real .xlsx with SheetJS
examples/         sample v1/v2 CSVs to try
TESTS.md          how to run tests + manual browser test plan

Run the tests: npm install && npm test


License

MIT © 2026 freyesperales. See LICENSE.


Development Experiment 064 of dev-experiments-365.

About

SheetDiff — git diff for spreadsheets, in your browser, free: compare two Excel/CSV matched by a key column, nothing uploaded.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages