sheets-diff
Structured diff engine for Microsoft Excel .xlsx workbooks.
Compares two workbooks and returns a typed, deterministic result — not just a text diff. Application developers get the data; they decide the presentation.
Overview
sheets-diff compares .xlsx workbooks at the cell level and returns a
WorkbookDiff carrying:
- per-sheet change classification (added, removed, renamed, moved, modified);
- per-cell typed value changes (
Integer,Number,Bool,DateTime, …); - per-cell formula text changes;
- structured diagnostics and per-level summary counts;
- deterministic ordering by sheet index, then
(row, col).
Supported format: .xlsx only. .xls, .ods, .xlsm, CSV, and other
formats are out of scope for v2. Passing a non-xlsx file returns a structured
error, never a panic.
Why / When
Use sheets-diff when you need:
- a library that returns structured data rather than printing a diff;
- typed values —
Text("100")andInteger(100)are distinct; - GUI or batch integration: bytes/reader inputs, progress events, cancellation;
- no hidden side effects — the library never writes to stdout/stderr or accesses the network.
It is intentionally not a spreadsheet editor, merge engine, or formula engine.
Quick Start
use compare_paths;
let diff = compare_paths?;
println!;
for sheet in &diff.sheets
Features
| Cargo feature | What it enables |
|---|---|
| (none) | Core library — no extra deps |
serde |
Serialize on all public model types; output::json helpers |
chrono |
ISO-8601 string synthesis for DateTime values |
cli |
Builds the sheets-diff binary (requires clap) |
Design Notes
- One
CellDiffper address. Value and formula changes are independent sub-fields; no duplicate-address entries. #[non_exhaustive]everywhere. Adding fields or variants in v2.x is additive — no forced semver bump for struct consumers.- Conservative by default. Sheet rename detection only fires when exactly
one old and one new sheet are unmatched. Ambiguous matches surface as
Added/Removedplus a diagnostic. calamine0.35 pinned. TheDataenum variant set is the grounding for allCellValueconversions.
More Detail
- Full documentation (mdbook)
- Migration from v1
- RFCs — design records for every significant decision