Skip to Content
Fetlar
Using Fetlar

Comparing files

See what changed between two Word, Excel, old Excel or CSV files, as a person would see it. Get a Word report or a highlighted spreadsheet.

fetlar diff OLD NEW shows what changed between two versions of a file. It compares what people see (words, cells, headings), not the hidden XML. A changed font or a re-saved file does not show up as a change.

fetlar diff contract-v1.docx contract-v2.docx
§4.2 Payment terms
- Payment within 30 days of invoice.
+ Payment within 60 days of invoice.

What compares with what

OldNew
Word (.docx)Word (.docx)
Excel (.xlsx or .xls)Excel (.xlsx or .xls)
CSV or TSVCSV or TSV

A CSV and a TSV compare, whatever the separator, because a delimited file is one sheet. A CSV is not compared with a workbook: it has no sheet names, formulas or number formats to line up. Any other pair is refused with a message that says which pairs work.

fetlar diff budget-v1.xlsx contract-v1.docx
fetlar: Can't compare a Excel (.xlsx) file with a Word (.docx) file. Files that compare: Word with Word (.docx), Excel with Excel (.xlsx or .xls), and CSV or TSV with CSV or TSV (.csv, .tsv)

PowerPoint and HTML files cannot be compared yet.

Word

Fetlar reports changed paragraphs (the JSON has the changed words), table cells one by one, headers, footers and footnotes. A paragraph that moved is reported as moved, not as deleted and added. Each change is shown under the heading it is in.

Add --formatting to also report a paragraph that became a heading, or a changed heading level.

Excel and old Excel

Cells are compared by the value Excel displays and by formula. An inserted or deleted row does not make the rows below it look changed. Sheets that were added, removed, renamed or hidden are reported.

fetlar diff budget-v1.xlsx budget-v2.xlsx
Sheet "Budget 2027"  B3  125,000.00 → 131,250.00
Sheet "Budget 2027"  B6  245,000.00 → 251,250.00

An .xls is read into the same grid as an .xlsx, so the two compare. Formulas are not compared when an .xls, CSV or TSV is on either side, because those do not store them.

CSV and TSV

Any encoding the reader handles works, Arabic included. A CSV is one sheet, so changes are named by cell.

fetlar diff p1.csv p2.csv
Sheet "Sheet1"  C2  4.50 → 4.80
Sheet "Sheet1"  A4  A3 → A4
Sheet "Sheet1"  B4  Ink → Tape
Sheet "Sheet1"  C4  19.00 → 2.10

Rows are compared by position, so a replaced row shows as changed cells.

Output formats

-f or --format is text (the default), markdown or json.

fetlar diff budget-v1.xlsx budget-v2.xlsx --format markdown
### Sheet "Budget 2027"

- Sheet "Budget 2027"  B3  125,000.00 → 131,250.00
- Sheet "Budget 2027"  B6  245,000.00 → 251,250.00

The JSON lists each change, and for edited Word paragraphs the changed words:

{"kind":"docx","changes":[{"kind":"edited","location":{"part":"body","section":"4.2 Payment terms"},"old":"Payment within 30 days of invoice.","new":"Payment within 60 days of invoice.","spans":[{"op":"equal","text":"Payment within "},{"op":"delete","text":"30"},{"op":"insert","text":"60"},{"op":"equal","text":" days of invoice."}]}]}

A Word report

--report OUT.docx writes the comparison as a Word document you can send. It works for every pair.

fetlar diff contract-v1.docx contract-v2.docx --report "contract (comparison).docx"

The report has a title, both file names and the date, the counts, then a section for each heading (Word) or sheet (Excel). In each, old text is struck through and new text is in bold. Moved paragraphs say where they came from. Cells show old and new values with their formulas. Arabic and other right-to-left text gets right-to-left paragraphs.

Reading the report back with Fetlar:

# Comparison report

Old file: contract-v1.docx

New file: contract-v2.docx

Date: 29 November 2026

# Summary

1 change found.

| Kind of change | Count |
|---|---|
| Edited | 1 |

# Changes

## §4.2 Payment terms

Edited

The report is an ordinary Word file with the changes shown by strike-through and bold. It is not a Word tracked-changes (redline) document.

A copy with the changes highlighted

For spreadsheets, --highlight-xlsx OUT.xlsx writes a copy of the new workbook. Changed cells are filled blue and the cells of added rows green. A new sheet called "Changes" lists every change: sheet, cell, old and new value and formulas. Deleted rows are listed there too.

fetlar diff budget-v1.xlsx budget-v2.xlsx --highlight-xlsx "budget (changes).xlsx"
fetlar: wrote budget (changes).xlsx: 2 cells marked, changes listed on the "Changes" sheet

The Changes sheet reads:

| Change | Sheet | Cell | Old | New | Formula |
|---|---|---|---|---|---|
| Changed cell | Budget 2027 | B3 | 125,000.00 | 131,250.00 |  |
| Changed cell | Budget 2027 | B6 | 245,000.00 | 251,250.00 |  |
  • A new .xlsx is patched in place. Values, formulas, number formats, column widths, merged cells, charts, pictures and defined names stay as they were. A sheet already named "Changes" makes the new one "Changes 2".
  • A new .xls, CSV or TSV, or an .xlsx that cannot be patched safely, is written anew from its cells. You keep values, formulas and sheet names, but not number formats, widths, merged cells, charts or pictures. The command tells you when this happens.
  • Neither --report nor --highlight-xlsx ever overwrites OLD or NEW.

Right-to-left text

Text is compared as stored. Arabic and other right-to-left text is never reordered or normalized.

Options

OptionMeaning
-f, --formattext (default), markdown (or md), json
--formattingalso report formatting-only changes
--hiddeninclude what the author hid
--timeout SECSgive up after this many seconds (exit code 2)
--compactone-line JSON
--highlight-xlsx OUT.xlsxa copy of the new spreadsheet with changes marked
--report OUT.docxthe comparison as a Word report

Exit codes

Like the Unix diff program:

CodeMeaning
0identical
1different
2error: an unreadable file, a pair that does not compare, a file over a safety limit, a timeout, or an output that cannot be written

This makes fetlar diff easy to use in scripts.

On this page