Why the Codex App Ships All of LibreOffice
An AI app bundling a full office suite sounds absurd — until you learn what soffice --headless can do for any pipeline touching documents.
Somewhere inside the ChatGPT/Codex desktop app sits a complete copy of LibreOffice. Simon Willison spotted it yesterday, and the reflexive take is "wow, that's a lot of bloat."
It's not bloat. It's a confession: when software needs to genuinely read and write Office documents, offline, there is exactly one battle-tested engine for the job — soffice --headless.
Why this matters
.docx, .xlsx and .pptx are zipped XML carrying two decades of compatibility cruft. Every "parse docx in pure JavaScript" package handles the happy path and folds on real files — tracked changes, embedded objects, custom XML parts.
LibreOffice already imports and exports hundreds of document formats. An agent that shells out to it gets real document read/write with zero API keys and zero data leaving the machine. Bundling a whole suite beats shipping a parser that works on demos.
How it works
soffice --headless runs the entire suite with no GUI. --convert-to pushes a file through an import filter, then an export filter: soffice --headless --convert-to pdf report.docx --outdir out/. The same binary does docx→html, pptx→pdf, xlsx→csv, odt→txt, and accepts explicit filters like --convert-to 'csv:Text - txt - csv (StarCalc)' when you need the obscure knobs.
Two behaviors shape every real deployment. First, each invocation spawns a fresh process and pays roughly one to three seconds of startup. Second, LibreOffice allows one running instance per user profile, so naive parallel calls silently no-op — pass -env:UserInstallation=file:///tmp/lo-$RANDOM to give each worker its own profile, or run unoserver as a persistent listener.
Where this helps
- LLM ingestion: convert docx/pptx to clean text before chunking, instead of praying a pip package survives the file.
- CI report generation: fill a .docx template, render to PDF, attach it to the release.
- Attachment previews: any inbound Office file becomes a PDF your viewer can display.
- Data pipelines: xlsx → csv straight into DuckDB or your warehouse.
Watch out
Fidelity isn't pixel-perfect — complex Word layouts shift slightly. Per-file startup makes one-conversion-per-request APIs embarrassing; batch or use a listener. And treat it like any parser of untrusted input: it has had CVEs, so run it in a container, unprivileged, and keep it patched.
Try it yourself
# docx -> pdf, fully offline, nothing installed on your host
docker run --rm -v "$PWD:/work" -w /work ubuntu:24.04 bash -c \
'apt-get update -qq && apt-get install -y -qq libreoffice-writer >/dev/null &&
soffice --headless --convert-to pdf --outdir out *.docx'TL;DR
- What happened: the Codex app bundles all of LibreOffice — because it's the only robust offline Office engine.
- Why it matters:
soffice --headlessgives agents and backends real docx/xlsx/pptx read/write, free and local. - Try today: run the one-liner above on the ugliest real-world .docx you can find.