Fetlar
This server does not currently have a deployable release on Glama. Follow the repository's setup instructions to install and configure it for your MCP client, including any required credentials and local dependencies.
Fetlar
Read Word, Excel and PowerPoint files exactly as their authors see them, from the command line, from Rust, or from any AI agent over MCP.
Fetlar reads the file's own XML, so the text is exact: real list numbers (3.2.1, (b), Arabic letters), tables
with merged cells, footnotes, charts as data, speaker notes, and Excel values the way Excel shows them (1,250.00,
15%, 01/03/2026). It renders nothing and does no OCR. One program (about a 6 MB download), no dependencies, fully offline.
Read
.docx.xlsx.pptx(and macro/template variants), old.xls, CSV, TSV and HTML to Markdown, text, JSON or a safe HTML previewWrite Word, Excel and CSV files from JSON, fill Word and Excel templates, or export what was read as
.docx/.xlsxCompare two versions of a Word or Excel file the way people see them: changed words, cells, formulas and moved paragraphs
Search your files offline with a local index that understands Arabic spelling, kept current as files change
Serve AI agents:
fetlar mcpgives Claude, Cursor and any MCP client tools to read, write, fill and search Office filesArabic and right-to-left text are first-class everywhere: never reordered, never mangled
0.7, pre-1.0. Output and options may still change before 1.0.
fetlar report.docx # Markdown to stdout
fetlar budget.xlsx -t text -o out.txt
fetlar deck.pptx -t json
cat file.docx | fetlar -
fetlar reports/ -o out/ # every Office file in a folder, on all coresInstall
curl -fsSL https://fetlar.dev/install.sh | sh # macOS and Linux
irm https://fetlar.dev/install.ps1 | iex # Windows (PowerShell)
brew install iamsj7/fetlar/fetlar # Homebrew (macOS and Linux)
npm install -g fetlar # npm (macOS, Linux and Windows)
npx -y fetlar report.docx # or run it once without installingOr download the archive for your system from Releases or
fetlar.dev (macOS, Linux and Windows; each includes the licence notices), unpack it
and put fetlar on your PATH. Homebrew and npm install the same signed builds; update them with
brew upgrade fetlar or npm update -g fetlar.
Or build it from source (needs Rust):
cargo install --git https://github.com/iamsj7/fetlar fetlar-cliUpdating
fetlar update --check # is a newer version out? (exit 0 up to date, 10 update available, 1 error)
fetlar update # download, verify and install the latest version
fetlar update --version 0.5.3 # a specific version (0.5.3 or newer; an older one than you have needs --force)fetlar update replaces the copy you run it with (also one installed with cargo install), and downloads the build for your system from fetlar.dev, checks its size and SHA-256 checksum against both latest.json and the version's SHA256SUMS, unpacks it next to the program, runs it once to confirm its version, and only then replaces the running program. Any failure leaves the current program untouched. If the program sits in a folder you cannot write to (a system folder, a package manager's), nothing changes and the install command for a copy you own is printed; it never uses sudo.
Updates are signed. The SHA256SUMS file of every release is signed offline with Fetlar's release key (a minisign signature, SHA256SUMS.sig, whose comment names the version, fetlar <version>), and fetlar update checks that signature, before reading anything in the list, against the public key built into the program; a download without a valid signature is refused. To check by hand: minisign -Vm SHA256SUMS -x SHA256SUMS.sig -P RWRxNSKFydwfQgglI2+/8tk7KUu9AAOHy8ZKHOtiqZEuTW90hL4R1blO. A server that is taken over can therefore not push a program to existing installs.
Privacy: Fetlar never checks for updates by itself. It does not contact the network unless you run fetlar update, and fetlar mcp never does. FETLAR_DL_BASE points the download at a mirror (https only, or http on localhost, for testing).
Related MCP server: opendocswork-mcp
Usage
fetlar <INPUT> [-t markdown|text|json|docx|xlsx] [-o FILE] [--md-tables auto|pipe|html]
[--normalize none|llm|search] [--images] [--no-notes] [--no-slide-numbers] [--hidden]
[--marks] [--formulas] [--diagrams on|strict|all | --no-diagrams]
[--max-cells N] [--timeout SECS] [--compact]
fetlar <INPUT>... -o FOLDER [same options]Option | |
|
|
| write to a file instead of stdout; with several inputs or a folder, the folder to write into |
|
|
|
|
| JSON only: list embedded pictures as |
| leave out PowerPoint speaker notes (included by default) |
| leave out the slide numbers and dates PowerPoint slides show (read by default; footers are always read) |
| include what the author hid: hidden slides, hidden sheets, rows and columns, and hidden text in Word. Deleted tracked changes and comments are left out either way. |
| show what formatting and annotations say, which plain text loses: Word highlights, text colour, shading, bold and italic, comments, tracked insertions and deletions and watermarks; cell fills and font colours in Word tables and Excel (with a colour name such as red or light blue), Excel notes, threaded comments, the conditional formatting that applies and dropdown lists (also lists on other sheets); PowerPoint comments, text and shape colours, the animation order and video and audio clips; link targets, picture alt text and equations as text. See Colours, comments and edits. |
| Excel: show each cell's formula after its value, |
| flowcharts, connector diagrams and SmartArt as steps and links. On by default; |
| Excel: read at most this many non-empty cells (default 2,000,000). The rest is cut off, and the output and stderr say so. |
| give up after this many seconds, with exit code |
| one-line JSON |
Inputs: .docx .docm .dotx .dotm .xlsx .xlsm .xltx .xltm .pptx .pptm .potx .potm .ppsx .ppsm, old Excel
workbooks (.xls, Excel 97-2003), which read like .xlsx (number formats, dates, hidden sheets, rows and
columns), and text formats: .csv .tsv (and .txt when it is clearly a delimited table) and .html .htm. CSV is
read with the delimiter found from the content (, ; tab |), quoted fields and line breaks inside fields,
ragged rows, and UTF-8, UTF-16 (with a byte order mark) or Windows-1256 / Windows-1252 text; numeric columns are
right-aligned in Markdown. HTML gives headings, paragraphs, nested lists (with start), tables (colspan and
rowspan as merged cells), links, <pre> and <br>, with dir and lang for right-to-left text; scripts,
styles, navigation and hidden elements are left out. Through fetlar mcp and the library, text formats are told by
the file name or, for bytes, by their contents. Folders given to fetlar still convert Office files only. The
other old binary formats (.doc, .ppt, not yet), Excel 5/95 workbooks and password-protected files are refused.
Exit codes: 0 success, 65 the file can't be read (damaged, protected, not an Office file), 66 the
input can't be opened, 74 the output can't be written, 75 the file is over a safety limit (expanded size
or number of parts) or took longer than --timeout.
Many files at once
Give several files, or folders, and an output folder:
fetlar reports/ -o out/ # out/q1.md, out/budget.md, ...
fetlar a.docx b.xlsx c.pptx -t json -o out/
find . -name '*.docx' -print0 | xargs -0 fetlar -t text -o out/A folder means the Office files directly in it (not its subfolders); hidden files and
~$lock files are left out. Files named on the command line are always tried.Each input gets one output file named after it with the format's extension:
report.docxbecomesreport.md,.txtor.json. Inputs that share a name (report.docxandreport.xlsx) keep their extension too:report.docx.md,report.xlsx.md. The output folder is created if needed.The files are converted at the same time, one per core, largest first. Each output is byte for byte what
fetlar <file>prints.Errors and warnings go to stderr, each line starting with the input's path, then a count of the files that failed. The other files are still converted. Exit code:
0when every file was converted, otherwise the code of the first input (in the order given) that failed, with the meanings above. Several inputs without-o, or-among several inputs, is a usage error (2).
Threads
Large workbooks (256 KB or more of sheet XML) are read a sheet per thread, and several inputs a file per
thread. The output is the same either way. FETLAR_THREADS=N caps the threads; FETLAR_THREADS=1 reads one
file and one sheet at a time, which uses the least memory.
Comparing files
fetlar diff OLD NEW shows what changed between two Word files, two Excel files (.xlsx or old .xls) or two CSV/TSV files, as people see it:
fetlar diff contract-v1.docx contract-v2.docx
fetlar diff budget-v1.xlsx budget-v2.xlsx --format markdown # or text (default) or json
fetlar diff prices-v1.csv prices-v2.csv # CSV, TSV and old .xls compare cell by cell
fetlar diff budget-v1.xlsx budget-v2.xlsx --highlight-xlsx "budget (changes).xlsx"
fetlar diff contract-v1.docx contract-v2.docx --report "contract (comparison).docx"§4.2 Payment terms
- Payment within 30 days of invoice.
+ Payment within 60 days of invoice.
Moved: "Termination" was §9, now §7 (text unchanged)
Sheet "Budget 2027" C14 125,000 → 131,250Word: changed paragraphs (the JSON has the changed words), table cells one by one, headers, footers and
footnotes, and moved paragraphs, each under the heading it is in. Excel: cells by the value Excel displays
and by formula; an inserted or deleted row does not make the rows below it look changed; sheets added,
removed, renamed or hidden. CSV and TSV (any encoding the reader handles, Arabic included) and .xls files compare through the same cell
grid. PowerPoint and HTML are not supported yet. Right-to-left text is compared as stored, never
reordered. Exit code like diff: 0 identical, 1 different, 2 error (including two different kinds of
file). --formatting also reports a paragraph that became a heading or a changed heading level. The library
has the same as fetlar::diff (diff_paths, diff_bytes, a serializable DiffReport).
What compares with what. Word with Word (.docx); Excel with Excel (.xlsx with .xlsx or .xls; an .xls is read into the same cell grid as an .xlsx); CSV or TSV with CSV or TSV (a delimited file is one sheet, so a CSV and a TSV compare whatever the delimiter). A CSV or TSV is not compared with a workbook, because it has no sheet names, formulas or number formats to line up. Any other pair is refused with a message that lists these, never with a zip error. For a file without an extension the delimiter and encoding are found from the content, which needs a few rows to be sure; a file named .csv or .tsv is always read as one.
A copy with the changes highlighted (spreadsheets, --highlight-xlsx OUT.xlsx; library fetlar::diff::highlight_paths): a copy of the NEW workbook with changed cells filled blue, the cells of added rows green, and a "Changes" sheet that lists every change (sheet, cell, old and new value, formulas), deleted rows included. A new .xlsx is patched in place: only the styles of the marked cells, the style table, the sheet list and the one added sheet change, so values, formulas, number formats, column widths, merged cells, charts, pictures and defined names stay exactly as they were (a sheet already named "Changes" makes the new one "Changes 2"). A new .xls, CSV or TSV, or an .xlsx the patch cannot handle, is written anew from its cells: values (numbers stay numbers), formulas and sheet names, but not number formats, column widths, merged cells, charts or pictures; the command says so when that happens. Deleted rows and removed sheets are listed on the Changes sheet only, there is nothing to colour. The file never replaces OLD or NEW.
A Word report (--report OUT.docx; library DiffReport::to_docx, for every pair): a title, both file names and the date, the counts, then a section per heading (Word) or sheet (Excel) with each change: old text struck through and new text in bold, moved paragraphs noted with where they came from, cells as old → new with the formulas. Arabic and other right-to-left text gets right-to-left paragraphs. --lang ar writes the whole report in Arabic, right to left (library DiffReport::to_docx_in). Both outputs open in Excel and Word without a repair prompt.
Searching files
fetlar index keeps a local full-text index of your Word, Excel, PowerPoint, CSV, TSV and HTML files, and
fetlar search finds every word in them in an instant. It works offline, reads the files exactly as fetlar
does (hidden sheets, slides, rows and text are not indexed unless you ask), and nothing leaves your machine.
fetlar index add ~/Documents/Contracts --name contracts # indexes it now; --types docx,xlsx to limit
fetlar search "مدة العقد" # all words must be in one section, sheet or slide
fetlar search payment --type docx,xlsx --limit 10
fetlar search احمد --json # for tools: files, locations, snippets, highlight ranges/Users/me/Documents/Contracts/supply.docx
docx · 48.2 KB · modified 2026-11-20
4.2 Payment terms: Invoices are «payable» in net 30 days.Each result names the place that matched: the nearest heading in Word and HTML (4.2 Payment terms), the sheet
in Excel (Sheet: Budget), the slide in PowerPoint (Slide 3: Plan), with the matching line and the matching
words marked («», or bold on a terminal). Several words must all be in the same place; "quotes" match a
phrase; -word leaves a word out.
Arabic. The same analyzer runs when indexing and when searching, so you do not have to type a word the way
it was written: احمد finds أحمد (alef variants أ إ آ ٱ are one letter), مدة finds مدّة and مدة
(diacritics, tatweel and ة/ه, ى/ي are folded), ٦٠ and ۶۰ find 60, and المدة finds مدة. Text is
normalized to Unicode NFC first. Light stemming is deliberately cautious: the article (ال وال بال كال فال لل)
is cut only when written with a bare ا (so إلهام is not ال + هام) and at least three letters remain; the
endings ان ين ون ات are cut only when at least four letters remain (so لبنان, تأمين, السودان and تمرين
stay apart from لبن, تام, سود and تمر), ها هم هن كم نا when three remain. Both the stemmed and the exact
spelling are indexed, and the exact one ranks higher. A search word that starts with و ب ل ك ف is also tried
without it (ومدة finds مدة); the index itself never cuts those letters. Numbers keep their separators inside
one word (12.500, 1,200 which also matches 1200, ٣٠٫٥, 2026-11-27). Latin text is lowercased. The files'
own spelling is what you see in results.
Command | |
| Add a folder and index it |
| Read new and changed files, drop deleted ones (unchanged files are not read; a touched file with the same content is not re-indexed) |
| Stay running and update the index a moment after files change (saves, copies, renames and deletes are noticed; Ctrl-C stops) |
| Folders; files searchable and skipped, last update, size and location; files that could not be read and why ( |
| Leave files out ( |
| Stop indexing a folder; delete its entries (or everything) but keep the folder list; start again from nothing |
update, add and rebuild take --hidden (also index what the author hid), --timeout SECS (per file, default
120) and --max-mb MB (default 200). Files are read on all cores (FETLAR_THREADS=N caps them), the biggest first as long as their estimated memory fits
in 512 MB together (--memory-mb MB or FETLAR_INDEX_MEMORY_MB changes it; a file bigger than that runs alone); a damaged,
protected or oversized file goes to the skipped list and never stops the run. A folder that cannot be found (a
disconnected drive) keeps its files in the index. Every --json output is stable for scripts.
--hidden, --timeout and --max-mb apply to the run, and each file remembers what it was read with: files that
were too large or timed out are tried again when the limit is raised, and update --hidden reads again the files
it affects (run later without it, they are indexed without the hidden parts again). If an update is interrupted
nothing is lost or duplicated; the next one repeats the work. Memory use is bounded: at most about 512 MB (by estimate, see --memory-mb) of file
data is held at once, whatever the number of threads.
The index is kept in your user data folder, readable by you only (0700 on Unix):
macOS ~/Library/Application Support/Fetlar/index, Linux $XDG_DATA_HOME/fetlar/index (default
~/.local/share/fetlar/index), Windows %LOCALAPPDATA%\Fetlar\index. Choose another with --index-dir DIR or
FETLAR_INDEX_DIR. It holds the search index (fetlar-tantivy/), catalog.json (each file's time, size and content hash,
so updates are incremental), .fetlar-index (marks the folder as ours: Fetlar never changes or empties a folder without it, and refuses a non-empty one) and fetlar-index.toml (folders, types, excludes and a reserved [schedule]), which
you may edit by hand. The index stores the text of your files: treat the folder like the files themselves.
Updates run by hand (fetlar index update), live while fetlar index watch runs, or every night: fetlar index schedule on --at 02:30 (off, status; off by default; one per-user task: launchd on macOS, Task Scheduler on Windows, a systemd user timer on Linux).
A spreadsheet hit names the cell (Budget!C14). fetlar search --save NAME WORDS keeps a search (with its --type); --saved NAME, --list-saved, --delete-saved NAME use it. AI agents may add folders to the index with the MCP tool index_add_folder, only inside a folder you allowed with fetlar index mcp-allow FOLDER (--list, --remove).
The library is the fetlar-index crate (Tantivy), separate from fetlar so the reader stays small and keeps
building for WebAssembly.
Writing Word files
fetlar write writes a Word document from JSON. Arabic and right-to-left text are first class: paragraphs,
runs, tables and sections can be right to left, lists number in Arabic letters (or hindiNumbers, Word's Hindi Arabic digits: Word for Mac shows them Devanagari, LibreOffice as 1 2 3), and
bold, size and fonts are set for complex-script text too. The file opens in Word without repair and passes
Microsoft's Open XML validator.
fetlar write report.json -o report.docx{
"kind": "docx",
"properties": {"title": "تقرير", "author": "المالية"},
"blocks": [
{"type": "heading", "level": 1, "text": "خطة الطوارئ", "rtl": true},
{"type": "paragraph", "rtl": true, "runs": [{"text": "الملخص: ", "bold": true, "rtl": true},
{"text": "Example Systems", "link": "https://example.com"}]},
{"type": "list_item", "ordered": true, "num_format": "hindiNumbers", "text": "البند الأول", "rtl": true},
{"type": "table", "rtl": true, "header_rows": 1, "rows": [["المسؤول", "الهاتف"], ["مدير الأمن", "0112345678"]]}
]
}Blocks are streamed into the file, so memory stays flat for any number of paragraphs: 20,000 paragraphs with
tables take 0.01 s. fetlar write --help lists every key; a key the writer does not know exits with code 3.
From Rust, fetlar::write::docx::DocxWriter writes to any std::io::Write:
use fetlar::write::docx::{DocxOptions, DocxWriter, Inline, ParaFormat, RunFormat};
let mut w = DocxWriter::new(std::fs::File::create("report.docx")?, DocxOptions::default())?;
w.paragraph(&ParaFormat::new().style("Heading1").rtl(), &[Inline::Text("خطة الطوارئ", RunFormat::new().rtl(true))])?;
w.finish()?;Saving what was read as Word or Excel
fetlar report.xlsx -t docx -o report.docx reads any file Fetlar opens (Word, Excel, PowerPoint, CSV, HTML) and writes
what it saw as a clean Word file; -t xlsx writes a workbook. Several files or a folder go into a folder, one
file each, and a file is never written over the one it was read from.
The Word file has real Word structure, not typed-in numbers: headings (levels 1 to 6), paragraphs with their links
(only http, https and mailto links are kept), real lists (bullets, 1. 2. 3., a. b. c., i. ii., Arabic letters
and digits, 1.1.1 outline numbers, a list that carries on at 3 or starts at (c), nested levels), tables with a
shaded header row, number columns aligned to the trailing edge, merged cells (gridSpan and vMerge) and right-to-left tables, speaker notes as quotes,
headers and footers, and the direction of every paragraph. Arabic text keeps the complex-script font and language
the writer sets for Arabic. Each sheet or slide starts on a new page (landscape for spreadsheets and slides). The
same input always gives the same bytes. Not kept, because the reader's model does not carry them: fonts, colors and
sizes, pictures, and where a footnote was cited (footnotes
become paragraphs that start with their number); a table wider than Word's 63 columns is split into several.
Reading the result again gives the same Markdown as the original, apart from those differences, the --- between
sheets (they become page breaks) and footnotes.
The Excel file has a sheet per sheet, slide or document; tables become rows, other text one cell each. Merged cells of a table are written as real merges (mergeCells). Cells whose
text is a plain number are written as numbers; anything else (1,250.50, 12%, 007, dates) stays the text the
reader showed, because the model has no number formats.
let doc = fetlar::read_path("report.xlsx", &fetlar::Options::default())?;
let word = fetlar::write::docx::from_document(&doc, &fetlar::write::docx::DocxOptions::default())?; // or doc.to_docx(..)
let book = fetlar::write::xlsx::from_document(&doc, &fetlar::write::xlsx::XlsxOptions::default())?; // or doc.to_xlsx(..)Filling templates
fetlar fill fills a Word or Excel file that has {{placeholders}} typed into it. Letters, certificates, invoices,
reports and forms keep their own styles, headers, numbering and page setup; only the placeholders change.
Arabic and right-to-left text are first class: an Arabic value put into a Latin run gets Arabic bold, italic and
size, dates come in Hijri (Umm al-Qura, as Excel computes it) and Gregorian, and digits can be Arabic-Indic.
fetlar fill letter.docx data.json -o out.docx
fetlar fill report.xlsx data.json -o out.xlsx
fetlar fill letter.docx people.json --each people --name "{id}-{name}" -o letters/ # a mail merge, all cores
fetlar fill letter.docx --names # what the template readsuse fetlar::template::{fill_docx, FillOptions, Template};
let letter = fill_docx(&std::fs::read("letter.docx")?, &data, &FillOptions::default())?;
// Mail merge: read and compile once, fill many times (also from several threads).
let t = Template::open(std::fs::read("letter.docx")?)?;
for person in people { let bytes = t.fill(&person, &FillOptions::default())?; }The syntax
Write | It does |
| a value; a name is looked up in the current loop item, then the outer loops, then the data. Names may be Arabic: |
| the current loop item; the data itself |
| in a loop: position (0 and 1 based), first, last, how many |
| the date given to the fill ( |
| repeat; an empty list repeats nothing; |
| show if the value is true (not null, false, 0, empty text, empty list); |
| one comparison: |
| formatters, chained left to right |
| a picture (Word); |
| a comment (removed); a literal |
Formatters: number:"fmt" (any Excel number format: #,##0.00, 0.0%, [$-2000401]0), date:"fmt"[:"ar"]
(dd/mm/yyyy, d mmmm yyyy; ar for Arabic month names), hijri:"fmt"[:"en"] (d mmmm yyyy gives
12 رمضان 1447), digits:"arabic" (or persian, latin), upper, lower, trim, default:"-", join:", ",
yesno:"نعم":"لا", count. A date is YYYY-MM-DD or YYYY-MM-DDTHH:MM:SS text, or an Excel serial number.
Curly quotes are accepted (Word turns " into them as you type).
Word
Placeholders work in the body, tables (also nested), headers, footers, footnotes, endnotes, text boxes and the result text of fields. Word splits text into runs where you edited, spell-checked or formatted it; a placeholder over several runs is found, and the value takes the first run's formatting.
Repeating: put
{{#items}}and{{/items}}in paragraphs of their own to repeat everything between them (those two paragraphs disappear); in two cells of one table row (or in cells of two rows) to repeat the row (or the rows from one to the other); or both in one paragraph to repeat text. A loop that takes every row of a table drops the table when the list is empty. Row formatting, borders, shading andcantSplitare copied with the row. Numbered paragraphs keep counting (Word numbers by position). Blocks nest.Right to left:
w:bidi,w:rtl, table direction and section direction stay as the template has them. When a value has Arabic letters and its run lacksw:rtl, the value gets a run of its own withw:rtl, andbCs,iCsandszCscopied fromb,iandszwhen those are on (aw:b w:val="0"stays off), so the text is as bold and as big as the Latin text next to it. The literal text around it keeps the run's own properties and its order (Latin literal (1): مرحبا 123 end.).Footnotes and endnotes in a loop: a reference inside a repeated block gets a note of its own per copy (new id; the note is copied and its placeholders are filled with that copy's item).
Numbers print the way Excel shows them in General: at most 15 significant digits (
0.1 + 0.2is0.3), whole numbers in full,1E-07and1.5E+20at the extremes.Templates (.dotx) and Word files saved as .docm without macros are filled into ordinary documents (the content type of the main part is rewritten, as Office refuses a document that still says it is a template). Files that can run macros are refused (exit 3).
Filling a filled file again: pictures get media names and relationship ids that the file does not use yet.
Ids: repeated content gets new
docPr, bookmark and revision ids and bookmark names (name_17); comment markers appear in the first copy only;paraId/textId(optional) are dropped from copies.Everything else is copied byte for byte, including the compressed bytes of every part that holds no placeholder. Styles, numbering, themes and settings are never read.
Pictures come only from what the caller allows: bytes registered with
ImageAccess::named, adata:image/png;base64,value in the data, or a file inside the folder given with--images DIR(relative paths only; every folder on the way is opened without following links, so a link planted in the folder cannot lead out of it). PNG, JPEG, GIF and BMP; the same bytes are stored once.
Excel
Placeholders work in cells (shared or inline strings). A cell that is only {{value}} gets a typed value: a
JSON number is a number, true a boolean, an ISO date text (2026-03-01) a date serial with the cell's format
(or a yyyy-mm-dd format when the cell has none), anything else is text. A value that starts with =, +, -
or @ is text and never a formula; a number with more than 15 digits is written as text, because Excel would
round it. A formatter (| number:...) makes the result text. Placeholders inside formulas are refused, so
data can never become a formula.
Repeating rows: put
{{#items}}in a cell of the first row to repeat and{{/items}}in a cell of the last (the same row is fine: one cell each). Rows below move down, and every reference to a moved row follows: formulas on all sheets (a total=SUM(D3:D3)over the template row becomes=SUM(D3:D1002)), merged cells (merges inside the repeated rows are repeated), conditional formats, validations, hyperlinks, filters, page breaks, defined names and print areas, Excel tables, chart ranges, picture and chart anchors, and the sheet's dimension. Row heights, hidden flags and styles are copied with the row. Loops nest (groups with their own subtotals): each copy of an outer loop has its own extent, so=SUM(B4:B4)in a group's subtotal row covers exactly that group's rows, and a grand total over the whole block covers every group. A loop can sit inside a{{?x}}block. A loop that would pass row 1,048,576 is refused (exit 75).Formulas in a repeated row follow Excel's fill-down rule: inside each copy, a relative row reference moves down with the copy, wherever it points (also to rows outside the block), and a
$-absolute row never moves. A reference to another row of the same block (relative) points to the same copy. Example: a running balance=C2+B3in the repeated row 3 (C2 is the opening balance above it) becomes=C3+B4in the second copy and=C4+B5in the third: 110, 105, 125 for amounts 10, -5, 20 on an opening balance of 100. Write$C$2to point at the opening balance from every copy. In nested loops a relative reference to a row of the outer block (such as the group header) stays in its group and moves with the inner copies.Rows that a false
{{?x}}removes are deleted as Excel deletes them: a reference to a deleted cell becomes#REF!, a range inside the deleted rows becomes#REF!, a range partly inside is clipped; formats, validations and anything else that covered only deleted rows are dropped.Notes (comments) and pictures move with their rows. Inside a repeated row they stay on the first copy only (a picture keeps its size). Notes in deleted rows are dropped. Extension lists (sparklines, 2010 data bars and other
x14conditional formats and validations) are moved too. Array formulas ({=...}) in a repeated row get their own range per copy.Table headers: a table whose header cell holds a placeholder gets its column names from the filled cells (XML-escaped, empty names become
Column3, a repeated name gets a number, so the header cell and the column always agree).Rich text: a cell with several formats that holds a placeholder takes the formatting of the run that holds it (the other runs' formatting is lost, as the text is joined into one value).
Charts: the cached values of a series whose range moved (or that holds a placeholder) are dropped, so Excel reads the cells again; chart titles are not filled (a warning says so).
Text that looks like
_x0041_is written as_x005F_x0041_, so Excel does not turn it into a character.An empty list keeps one empty row, so ranges such as
SUM(D3:D3)stay valid; a false{{?x}}block removes its rows.Stored results of formulas are dropped and the workbook is marked to calculate when opened (
fullCalcOnLoad), so Excel shows the right numbers; a program that does not calculate (including a Fetlar read of the file) sees empty formula cells rather than the template's old results.
Safety and errors
Data is only ever data: it is XML-escaped, never parsed as markup, as a placeholder (
{{in a value stays{{), or as a formula. No field codes,DDE, links or fonts are written; control characters are dropped.Every placeholder without data is reported in one error with its place (
{{customer.name}} (word/document.xml, paragraph 12: "Dear {{customer.name}}..."),Sheet1!C7);--missing leave|emptychanges that.Warnings (
FillReport::warningsfromTemplate::fill_report, printed on stderr by the command line): a{{in a place that is not filled (an Excel header or footer, a note, a sheet name, a chart, a Word comment, a document property) stays as written and is reported; so is anything that refers to something outside the file.FillOptions::strip_external(--strip-external; off by default) parses the package: it removes an attached template, digital signatures, ribbon customizations and web add-in panes, leaves out parts nothing refers to, and refuses (exit 3) every relationship that is not on the allowlist of internal types (remote pictures, embedded objects, ActiveX, altChunk, subdocuments, external workbooks, data connections, mail merge sources, links other than http, https and mailto),DDE/INCLUDETEXT/INCLUDEPICTURE/LINK/IMPORT/DATABASE/MACROBUTTONfields however they are split or spelled, and a main document other than/word/document.xmlor/xl/workbook.xml.FillOptions::screen_formulashands every formula of an Excel template to a check of the caller's;max_uncompressed_mbcaps what the output expands to.Template mistakes are errors with places: unclosed or unmatched blocks, a block closed in another level (inside a link),
{{never closed, unknown formatters, a placeholder in a formula. Macro-enabled files and Strict Open XML are refused (exit 3).Limits: 400,000 placeholders, 12 million XML elements and 384 MB of compiled output for the whole template (a file made of thousands of small parts fails fast, with a clear error), 200,000 blocks per part (compile time is linear), 256 MB of XML in all, blocks nested 64 deep, 20 million loop iterations, 2 GB of output, 1 million characters per value, 10 MB per picture;
--timeout.The output is written to a temporary file and renamed, as
fetlar writedoes. With--eachall files are written into a hidden folder (each created new, never over something) and moved in place when every one succeeded; the first failure stops the rest, a move that fails is rolled back, and a file already in OUT is not replaced unless--overwrite.--each report.peopletakes only that list out of the data: the rest ofreportstays available. Names are normalized (NFC), compared without case, and lose invisible format characters such as U+202E. Picture files with more than one hard link are refused.Exit codes: 0, 2 bad command line, 3 not supported, 65 template or data invalid or a value missing, 66 an input cannot be opened, 74 output, 75 limit or
--timeout.
Speed
On an Apple M-series laptop (uv run tools/writer-check/bench.py --fill, median of 5 cold runs; every output is
read back and checked): a report of 50 sections with a 20-row table each (about 50 pages, nested loops) takes
about 10 ms and 6 MB; 1,000 letters take 0.10 s on all cores and 0.13 s on one thread (docxtpl 1.5 s, docxtemplater
0.75 s). See tools/writer-check/RESULTS.md for the table, the correctness probes against docxtpl and
docxtemplater, and how to read them.
Editing files in place
Change one thing in a real document, a date in a contract, a figure in a budget, a word on a slide, without breaking the rest. Fetlar patches the file where the edit is: every other part of the file is copied byte for byte, and inside a changed part only the changed paragraph, row or cell is written again. It works offline and takes milliseconds.
fetlar edit contract.docx --replace "30 days" "45 days" -o contract-v2.docx
fetlar edit budget.xlsx --set "Budget!C14=125000" --set "B3==SUM(B1:B2)" --in-place
fetlar edit deck.pptx --replace 2025 2026 --slide 4 -o deck-2026.pptx
fetlar edit letter.docx --edits changes.json --author "Sara" -o letter-v2.docxWord (
.docx,.docm): replace text (formatting kept, also when the text is split over runs), insert a paragraph or a table row after some text (--insert-after,--insert-row-after), delete a paragraph, add a comment, accept or reject all tracked changes. Every text edit is a tracked change with an author and a date, so a person reviews it in Word;--no-trackmakes plain edits.Excel (
.xlsx,.xlsm): set a cell's value or formula. Its style and number format stay; Excel recalculates when it opens the file. A cell in an array formula is refused; a cell in a shared formula is handled (the others keep their own formulas).PowerPoint (
.pptx,.pptm): replace text in slides, tables and speaker notes (--slide N,--notes). PowerPoint has no tracked changes, so the edit is direct, and the report says so.
Matching is exact and case-sensitive on the text people see (deleted text, field codes and hidden text are not matched). It may cross runs of different formatting and never crosses a paragraph. --expect N fails unless there are exactly N matches.
The edits are all-or-nothing. If one cannot be applied (no match, a text in two paragraphs, a wrong --expect), nothing is written and the exit code is 65. A digitally signed file is refused unless --force (its signature will no longer be valid). The output is written to a temporary file and renamed, so a failed edit never leaves a partial file. --dry-run says what would change and writes nothing.
Macro-enabled files (.docm, .xlsm, .pptm) can be edited here; Fetlar warns that their macros are kept unchanged and not checked. The MCP tool refuses them.
The report lists what each edit did, then what fetlar diff finds between the old and the new file (Word and Excel). -f json gives it as JSON. From an AI agent, the MCP tool edit_office_file does the same, inside the folders the server may write to, with Word edits as tracked changes by "AI (Fetlar)" unless told otherwise. In Rust: fetlar::edit::edit.
Use with AI agents
Agents such as Claude Code, Codex and Cursor cannot read Office files on their own. Fetlar gives them two ways.
MCP server. fetlar mcp speaks the Model Context Protocol on stdin and
stdout and offers ten tools:
describe_office_file: the pages (document, sheets or slides) with titles and sizes;read_office_file: the content as Markdown, text or JSON, withpages,notes,slide_numbers,hidden,marks,formulas,diagramsandnormalizeoptions. Long output comes in parts, so a huge workbook cannot flood the agent's context; the later parts are served from a private cache (see below), so they do not read the file again;edit_office_file: changes one thing in a.docx,.xlsxor.pptx(see Editing files in place):path,output,edits, and optionallyoverwrite,track,author. It writes a new file inside the allowed folders and returns what changed. Macro-enabled files are refused here (the command line edits them with a warning);write_office_file: writes a.csv,.tsv,.xlsxor.docxfrom JSON content (path,content, and optionallykind,overwrite,options), Arabic and right-to-left included. It returns the absolute path, the size and what Fetlar reads back from the new file;describe_write_format: the exact JSON format of each kind with examples, so a model writes valid content on the first try; withkind: "template"it gives the placeholder syntax of templates (Arabic examples);fill_office_template: fills a.docx,.dotx,.xlsxor.xltxtemplate that has{{placeholders}}(see Filling templates) with JSONdata(template,data,path, and optionallyoverwrite,missing). One output per call; for a mail merge the model calls it once per record. It returns the absolute path, the size, structured warnings (kind, location, message) and a read-back.search_office_files: full-text search over the folders indexed withfetlar index add(see Searching files):query,typesandlimit; returns the files with the sheet, slide or section that matched and the matching line. The user chooses what is indexed;index_status: the folders indexed, files searchable and skipped, and the last update.index_add_folder: adds a folder to the index, only inside a folder the user allowed for AI tools withfetlar index mcp-allow; it runs with the memory cap like the read tools, and refuses with the way to allow a folder otherwise.compare_office_files: what changed between two Word, Excel (.xlsx,.xls), CSV or TSV files (old_path,new_path, and optionallyformatting,hidden,max_changes,offset; see Comparing files for the pairs that compare). It returns a short summary and the same JSON asfetlar diff -f json; long results come in parts likeread_office_file. It reads both files likeread_office_filedoes and writes nothing;
Client | Setup |
Claude Code |
|
Claude Desktop | in |
Codex | in |
Cursor | in |
Use the full path to fetlar if the client does not inherit your shell's PATH. With Node.js and nothing
installed, npx works in place of fetlar in any of these: claude mcp add --scope user fetlar -- npx -y fetlar mcp,
or "command": "npx", "args": ["-y", "fetlar", "mcp"].
Each tool call runs in its own child process, so a file that crashes the reader or keeps it busy costs one error result, and the server keeps serving. Two environment variables set the limits for a call:
Long results are cut in parts. The server keeps each cut result in a private cache (a per-user temporary folder, permissions 0700 and 0600, at most 512 MB, removed when the server ends; Unix only), checked against the file on every call, so asking for the next part does not read the file again.
Variable | Default | |
|
| seconds a call may take before it is stopped and returns an error |
|
| address-space limit for the child process, |
| the server's working directory | folders |
| the write folders | folders |
|
| largest template file |
|
| most loop iterations in one fill |
|
| largest filled file |
|
| largest filled file once uncompressed (all parts together) |
|
| largest |
|
| largest picture in a Word document |
|
| most characters in one cell, paragraph or run ( |
| on |
|
Render cache. When read_office_file output is too long for one reply, the server keeps the rendered text on
disk for the rest of the session, so that following offset does not read the file again for every part. It is
plain text, in $TMPDIR/fetlar-mcp-cache-<uid>/<server pid>-<time>/ (the system temporary folder). The cache is
private to you: the folders have mode 0700 and belong to your user (a folder that is a link, someone else's or open
to others is not used), each entry is a file with mode 0600, and all entries together are capped at 512 MB. The
server deletes its folder when the session ends; if it is killed so that it cannot (for example with SIGKILL),
the next fetlar mcp to start deletes it. A file that changes is read again, never served from the cache. Unix
only: on Windows nothing is cached. If the text of sensitive files must not reach the disk, set TMPDIR for the
server to a folder in memory or on an encrypted volume.
Writing is confined. The writing tool assumes the model that calls it may have been prompt-injected:
Output goes only under the allowed folders. Symbolic links and
..are resolved before the check, a symbolic link is never followed, devices, pipes and folders are refused, and an existing file is replaced only when the call saysoverwrite: true. The extension must match the kind (.csv, .tsv, .xlsx, .docx only; no dot-files, no build or package file names), so the tool cannot create scripts or configuration files. The folder is held open and reached from the allowed folder without following any link, and the file is created and renamed inside it (never replacing an existing file unlessoverwriteis true), so a link planted while the call runs cannot redirect the write. This applies on Unix. The file is written to a temporary file and renamed, asfetlar writedoes.Word files are always written in safe mode: only fields that compute from the document, and only
http,httpsandmailtolinks. CSV cells that start with=,+,-or@are prefixed with', always: a call cannot turn the guard off, onlyFETLAR_MCP_CSV_GUARD=offin the server's environment can, and delimiters are limited to,;|space and tab. Excel formulas may call only functions that compute from values (an allow-list); IMAGE, WEBSERVICE, INDIRECT, DDE and references to other workbooks are refused, defined names, validation sources and print areas take plain references only, and Excel links to anything but http, https and mailto are refused.Pictures are base64 data in the JSON or files under the allowed folders (opened without following links, one name only); URLs and
file:links are refused. Only PNG, JPEG, GIF and BMP are accepted (no SVG), at most 100 megapixels and 1,000 different pictures.A call that outlasts the limit is stopped, and calls are handled one at a time: one slow write delays the calls behind it. An empty or relative
FETLAR_MCP_WRITE_ROOTSmeans nothing is writable.Sizes are capped (variables above), and a write that outlasts
FETLAR_MCP_TIMEOUT_SECSis stopped and leaves no file behind.
Filling is confined too. The template and the data may both be hostile:
The template is read only from the template folders (
FETLAR_MCP_TEMPLATE_ROOTS, else the write folders), opened without following a link, and must be a regular file with a single name,.docx,.dotx,.xlsxor.xltx, withinFETLAR_MCP_MAX_TEMPLATE_MB. Macro-enabled files (.docm,.xlsm, or a file holding a macro project) are refused, and the name must match what is inside. A missing file, a file outside the folders and a link out of them get the same message.The output follows the rules of
write_office_file(inside the write folders, no link followed, no replacing withoutoverwrite, never the template itself) and is the same kind as the template:.docxfrom a Word template,.xlsxfrom an Excel one.The template package is parsed, not text-matched: everything that refers to something outside the template file is removed (an attached template, signatures, ribbon, add-in panes, parts nothing refers to) or refused (relationships of types outside an allowlist, remote pictures, embedded objects,
DDEandINCLUDETEXTfields however spelled, links to other workbooks, data connections, macros), and listed in the warnings. Every formula of an Excel template goes through the formula check ofwrite_office_file. Pictures come only asdata:image/...;base64values indata(PNG, JPEG, GIF, BMP; the size, pixel and count caps ofwrite_office_file), never as file paths or URLs.Values are text: escaped, never formulas, markup or placeholders. Loop iterations, output size and the length of a value are capped (variables above), and the call has the time limit.
Set FETLAR_MCP_WRITE_ROOTS in the client's server entry (for example "env": { "FETLAR_MCP_WRITE_ROOTS": "/Users/me/Documents/reports" }) to choose where agents may write.
Skill. skills/fetlar/SKILL.md teaches Claude when and how to use Fetlar, through
the MCP tools or the command line. Copy the skills/fetlar folder to ~/.claude/skills/ (or a project's
.claude/skills/). For Codex or any agent that reads AGENTS.md, one line is enough:
- Word, Excel and PowerPoint files: run `fetlar <file>` to read them as Markdown (`-t json` for structure).On Glama. Fetlar is listed in the Glama MCP directory, where you can browse its tools and check its quality score before you install it.
What you get
Word | Excel | PowerPoint | |
Pages | the whole document | one per visible sheet | one per visible slide |
Headings | from heading styles and outline levels | sheet name | slide title |
Lists | the document's own numbering, including Arabic abjad and | bullets and numbering | |
Tables | merged cells (as | values as Excel displays them, merged cells, split at blank rows, title rows split off, grouped header rows | yes, merged cells too |
Also | footnotes and endnotes, headers and footers (once), text boxes, content controls, tracked insertions, hyperlinks, equations, symbol fonts | text boxes on the sheet | grouped shapes in reading order, SmartArt, speaker notes, slide master text (once) |
Charts | as a data table from the chart's saved values | as a data table |
Charts get one caption line before their table in Markdown and text: their type, title and axis titles.
Left out on purpose, because a reader of the document doesn't see them:
hidden text and text smaller than 2 pt;
deleted tracked changes and comments;
hidden sheets, rows and columns;
hidden slides, and slide-number and date placeholders.
Excel values come from the values Excel saved with the file (--formulas adds each cell's formula). A formula that was never calculated has no
saved value.
Colours, comments and edits (--marks)
Plain output drops what formatting means: which points are highlighted, which rows are red, what a reviewer commented. --marks (MCP: marks: true) shows it; without it the output carries no marks.
Word: highlight, text colour, run shading, bold and italic; comments with the text they cover; tracked insertions and deletions with author and date; watermarks (
[watermark: DRAFT]); link targets, picture alt text, equations as text.Excel: cell fills and font colours (theme and indexed colours resolved, with a name), notes and threaded comments, the conditional formatting rule that gives a cell its fill, and dropdown lists, including lists that live on another sheet or in a defined name (the first 100 options, then
… (+N)).PowerPoint: comments with author, date and replies, text and shape fill colours (theme colours resolved through the slide, layout and master), highlights, bold and italic, the animation build order (
Animation order: 1. …; 2. …) and video and audio clips.Markdown gets inline HTML (
<mark data-color="yellow">,<ins>,<del>),[fill:FF0000 red]after a cell and[^c1]comment notes; JSON getsmarks,cell_marksandcomments, andformulaswith--formulas.
Diagrams
Flowcharts and connector diagrams in PowerPoint, Word and Excel, and SmartArt, are read as steps and links
instead of a pile of words. The file's own connectors give the links (a connector glued to two shapes is
exact); a line that only touches or sits next to a shape is read by position. A line that cannot be tied to
two shapes is counted in the JSON (unresolved) and never guessed.
1. Invoice received → 2
2. Check against PO → 3
3. ◇ Over 10,000? → No: 4 · Yes: 5
4. Manager approves → 6
5. CFO approves → 6
6. Pay invoiceSymbols and numbers only; no words are added to the file's own text, and each step's text appears once.
Symbol | Meaning |
| step number (a walk from the start; ties are broken in reading order, right to left on right-to-left pages) |
| link to step n; |
| a link without a direction |
| a decision |
| a link found by position, not stated by the file |
| the swimlane a step sits in |
A hierarchy (org chart) is a nested - list. Charts say what they are in JSON (chart.chart_type, stacking,
axis titles, invisible helper series), and a Gantt chart (a stacked horizontal bar chart with an invisible
first series of dates) is read as tasks with start, end and duration in the file's own date format.
Diagrams are on by default. --no-diagrams gives the text as before 0.7.1; --diagrams=strict keeps only
links the file states or that touch; --diagrams=all also keeps links found by position when unsure. The MCP
tool takes diagrams (on, strict, all, off).
JSON
{
"kind": "docx",
"pages": [
{
"page": 1,
"title": null,
"blocks": [
{ "type": "heading", "text": "1 Overview", "rtl": false, "level": 1, "page": 1 },
{ "type": "list_item", "text": "Approve the budget", "rtl": false, "level": 0, "ordered": true, "label": "1.", "page": 1 },
{ "type": "table", "text": "Item | Amount\nSalaries | 1,234,567.89", "rtl": false,
"rows": [["Item", "Amount"], ["Salaries", "1,234,567.89"]], "page": 1 }
]
}
]
}Block types:
heading: haslevel;paragraph;list_item: haslevel,orderedandlabel;tableandchart: haverows, and a chart also hastitle. A table with merged cells also hasspans, a list of{"row", "col", "rowspan", "colspan"}(0-based,rowandcolare the top-left cell of the merge, and every span covers more than one cell); the cells it covers are empty strings inrows. A table without merged cells has nospanskey. Spans come from<mergeCells>(Excel),MERGEDCELLS(old.xls),gridSpanandvMerge(Word),gridSpan,rowSpan,hMergeandvMerge(PowerPoint) andcolspanandrowspan(HTML);diagram: a flowchart, connector diagram or SmartArt, with adiagramobject (kind,source,nodes,edges,lanes,unresolved; see Diagrams). A chart block may also carry achartobject (chart_type,stacked,axes,helper_series,timeline). Tools should ignore block types and keys they do not know;note: speaker notes;footnote;headerandfooter;image: only with--images.
page is the Word page a block starts on, when the file records page breaks.
Accuracy and speed
Accuracy: Fetlar 0.7.2, measured on 2026-12-04. Speed and memory: Fetlar 0.7.1, measured on 2026-12-04; 0.7.2, re-checked the same day, ran at 5.4 ms median, 1.8 s total and 256 MB peak. Compared with Docling (2.154 for speed, 2.156 for accuracy), MarkItDown 0.1.9 and pandoc 3.13 on the same files, method and machine.
The charts are drawn from docs/bench/results.json by scripts/bench_charts.py.
The full method is in docs/bench/methodology.md.
The 112-file test
112 real Word, Excel and PowerPoint files (46, 36 and 30) from statistics offices, central banks, governments, universities and companies, in English, Arabic, French, German, Spanish and Chinese; 18 are in Arabic.
Each Word and Excel file is saved as PDF by LibreOffice. Each PowerPoint deck is saved as PDF by Microsoft PowerPoint, the app its authors used, and the speaker notes are added as PowerPoint holds them, because a slide PDF has no notes. Every tool's output is compared word for word with that text:
recall is the share of the words a reader sees that the tool found;
precision is the share of the tool's words that a reader sees.
Tool | All files | Word | Excel | PowerPoint | Failed |
Fetlar | 95.9% / 96.5% | 92.0% / 94.5% | 98.4% / 96.7% | 98.6% / 99.5% | 0 |
Docling | 85.2% / 86.6% | 91.5% / 94.5% | 77.8% / 64.1% | 83.5% / 99.8% | 4 |
MarkItDown | 87.6% / 84.6% | 91.2% / 94.4% | 78.7% / 60.3% | 92.6% / 98.8% | 0 |
pandoc | 83.9% / 81.3% | 90.9% / 94.5% | 76.9% / 58.8% | 81.4% / 87.3% | 1 |
Each cell is recall / precision.
Word: a tie. All four tools read ordinary Word files about equally well.
Excel: the other tools miss about a fifth of the words, and about a third or more of what they print is not on the sheet as Excel shows it.
PowerPoint: Fetlar finds the most words (98.6%), including speaker notes, slide numbers, dates and footers as the slides show them, and equations as text. Docling prints slightly fewer words that are not on the slide (99.8% against 99.5%) but finds 15 points fewer and fails on one deck. Against LibreOffice's PDF instead, which has no notes and draws equations as pictures, Fetlar scores 96.7% / 85.5% (slides) and 96.0% / 94.6% (with notes pages); MarkItDown 95.0% / 88.4% and 94.4% / 98.3%.
Failures: a failed file is left out of that tool's average, which flatters it. Counted as 0, Docling falls to 82.1% / 83.5% and pandoc to 83.2% / 80.6%.
Arabic: on the 18 Arabic files Fetlar scores 82.3% / 86.3% against 77.9% to 78.9% recall and 83.2% to 83.3% precision for the others. The reference text for Arabic has a known letter-order problem, so these numbers are lower for every tool.
What this result is not. The set was tested blind once, on 2026-11-23, and then inspected while Fetlar was developed, so accuracy on it is no longer a blind result. Speed and memory are not affected. Before this release, PowerPoint was scored against LibreOffice's PDF (Fetlar 0.7.1: 93.7% / 85.2%); against the PowerPoint reference, 0.7.1 scores 96.4% / 99.5%. Earlier published numbers (95.1% / 94.3% on 111 files) used Microsoft Office's PDFs from a run whose PDFs no longer exist, so they are not directly comparable. On the same LibreOffice reference, Fetlar went from 94.4% / 92.7% to 94.5% / 92.8% in 0.5.0, and 0.6.0 and 0.7.1 score the same (0.7.1: precision 0.1 point lower, from the new chart caption lines), so none shows an accuracy change. The score is agreement with the text of a PDF, not truth.
Speed and memory
The same 112 files, one tool at a time on a MacBook Pro with an Apple M5 chip and 24 GB:
Tool | Typical file (median) | All 112 files | Peak memory | How it ran |
Fetlar | 5.4 ms | 2.0 s | 265 MB | a new process per file |
pandoc | 63 ms | 125 s | 10.3 GB | a new process per file |
MarkItDown | 80 ms | 219 s | 1.8 GB | in one warm Python process |
Docling | 180 ms | 341 s | 7.35 GB | in one warm Python process |
Fetlar is 11 times faster per file and 62 times faster over all 112 files than the next best tool, and uses 6 times less memory than the next best (all rounded down; memory is 14% of the next best's). Fetlar 0.6.0 used 456 MB and 6.0 ms on the same files.
Not an idle machine. Other programs were running (load average about 2.5 to 3.5 for the other tools on 2026-12-03, about 4 for Fetlar on 2026-12-04). A re-run of all four on a quiet machine is planned.
Python tools were timed warm, in one process with imports excluded, which favours them. Docling's start-up took 1.6 s in this run and 29 s the first time it ran on this Mac.
Peak memory is the largest workbook for every tool (more than 2 million cells). Fetlar reads that workbook on all cores.
Hand-checked set
11 documents with known correct content: Word forms, an Arabic letter, tracked changes, fields and footnotes; Excel number formats, hidden and right-to-left sheets; PowerPoint reading order, hidden slides and notes; and the same files re-saved by LibreOffice, which writes very different XML. "Leaks" counts hidden text, deleted changes, hidden sheets and slides, and field codes that show up in the output.
Tool | Text error (CER) | Headings F1 | Table cells F1 | Leaks |
Fetlar | 0.9% | 1.00 | 0.999 | 0 |
Docling | 12.8% | 0.73 | 0.905 | 0 |
pandoc | 20.5% | 0.87 | 0.862 | 28 |
MarkItDown | 21.0% | 0.83 | 0.846 | 28 |
These files were used during development, so the blind test above is the fairer comparison.
Safety
Office files from the internet are untrusted, so Fetlar:
parses XML without DTDs or entity expansion;
checks the number of zip parts and their expanded size before reading anything;
caps cells, slides, sheets and nesting depth, and reads very deep nesting as plain text instead of recursing;
recovers damaged zips from their local headers, as Word and LibreOffice do.
It is fuzz-tested on mutated real-world files.
Library
[dependencies]
fetlar = { git = "https://github.com/iamsj7/fetlar" }let doc = fetlar::read_path("report.docx", &fetlar::Options::default())?;
let md = doc.to_markdown(&fetlar::RenderOptions::default());
for page in &doc.pages {
for block in &page.blocks {
println!("{} {}", block.kind.as_str(), block.text);
}
}Large workbooks are read a sheet per thread on rayon's global thread pool (or the pool the call runs in);
set Options::parallel to false, or build without the default parallel feature, to stay on the calling
thread. The result is the same.
CellMark (a cell's colours and comments, from --marks) stores its fill and font colour as Rgb and keeps its rare fields in CellMore, read through accessor methods; Rgb, RgbHex and CellMore are exported. This changed in 0.7.1 and is why the version moved from 0.6 to 0.7.
Development
cargo test # unit and golden tests
cargo run --release --example bench -- DIR # timing
cargo deny check # licences, advisories, sources (deny.toml)
scripts/third-party-notices.sh # regenerate THIRD-PARTY-NOTICES.txt after dependency changes
scripts/pgo-build.sh [TARGET] # release binary with profile-guided optimisation (as releases are built)Release binaries are built with profile-guided optimisation trained on the test fixtures
(scripts/pgo-build.sh, needs the llvm-tools rustup component), which makes them 15-25% faster than a
plain cargo build --release; the script checks the optimised binary against the golden outputs.
Fetlar builds with Rust 1.91 or newer (rust-version in Cargo.toml, tested in CI). CI also checks the
library's public API against the latest release tag with cargo semver-checks, and Dependabot
proposes dependency and GitHub Actions updates weekly.
Each release ships a CycloneDX SBOM (fetlar-<version>-sbom.cdx.json) and .sha256 checksums
next to the archives. Where GitHub build provenance attestations are available, verify an archive with
gh attestation verify <archive> --repo iamsj7/fetlar.
Fuzzing
The fuzz/ directory holds cargo-fuzz targets: read_any (raw
bytes), zip_part (a test fixture with one zip part replaced, to reach the XML readers), docx_html (Word's
imported HTML), numfmt and normalize. They run nightly in CI for five minutes each. To run one locally
(needs a nightly toolchain and cargo install cargo-fuzz):
uv run fuzz/seed_corpus.py # seed corpus from tests/fixtures
cd fuzz && cargo +nightly fuzz run -O zip_part corpus/zip_part -- -max_total_time=300A crash is saved under fuzz/artifacts/<target>/; replay it with cargo +nightly fuzz run <target> <file>.
Contributing
Bug reports, fixes and new test files are welcome; see CONTRIBUTING.md. Commits need a
Developer Certificate of Origin sign-off (git commit -s). Security issues go to SECURITY.md,
not to public issues.
Fetlar for organizations
Fetlar is free and open source for everyone, including businesses. An enterprise edition with admin policy, audit logging, support agreements and long-term-support releases is planned for banks, governments and other regulated organizations: hello@fetlar.dev.
License
Fetlar is licensed under the Apache License, Version 2.0. Copyright 2026 Shaik Jaleel; see also NOTICE. Versions 0.5.0 to 0.5.6 were released under the earlier Fetlar License Agreement; from 0.6.0 on, Fetlar is Apache-2.0.
"Fetlar" and its logo are trademarks of Shaik Jaleel. The licence covers the code, not the name: a modified or redistributed version must not be called Fetlar or suggest it is the official one. See TRADEMARKS.md.
The licences of the third-party crates compiled into the fetlar binary, with their full texts, are in
THIRD-PARTY-NOTICES.txt, which is also included in every release archive. All
are permissive (Apache-2.0, MIT, Unicode-3.0, Zlib); cargo deny check enforces this.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
This server cannot be deployed
Maintenance
Related MCP Connectors
Free offline file conversions and bounded DOCX text extraction. Supplied bytes; no network.
Merge brand-safe .docx/.pptx templates with table loops and extract Office files to Markdown.
Create Word .docx files from sections or markdown, fill templates, and read text from a .docx.
Real .docx and .xlsx files from structured data, with automatic Hebrew/Arabic RTL.
Related MCP Servers
- AlicenseDqualityDmaintenanceEnables reading, writing, editing, and converting Office documents (ODT, DOCX, ODS, XLSX, PDF, etc.) using MCP tools, with no external dependencies.1117 npmMIT

opendocswork-mcpofficial
AlicenseNot gradedqualityCmaintenanceRust-native MCP server for Office document processing (Excel, Word, PowerPoint) enabling sub-millisecond, local-first document manipulation and export to PDF.167GPL 3.0- AlicenseAqualityCmaintenanceMCP server for Office documents — create, edit, fill templates, convert, and extract Word/Excel/PowerPoint. LaTeX-style markup, math formulas, PDF export, template loops, and document diff. stdio / SSE / Streamable HTTP with auth and rate limiting.1214 PyPIApache 2.0
- AlicenseAqualityBmaintenancePure-Rust local document engine and MCP server with 92 offline tools: merge, split, compress, OCR, convert, sanitize, redact, fill forms, and chunk PDFs without cloud dependencies.92802Apache 2.0