Command Line

Automate Office Files from the Terminal

lynxoffice brings the LynxOffice document engine to Terminal and your scripts. Read workbooks, review Word documents, and work with PDFs, with output in plain text, TSV, or JSON.

Text, TSV, and JSONWorks in scriptsRuns without the app

Free while in early release. The app runs on macOS 13 or later; the command needs macOS 14.

Commands

Every command, grouped by the kind of file it works on.

lynxoffice commands
Spreadsheets
formulaEvaluate a formula against data you pass as JSON.
queryPrint a cell range from an .xlsx as tab-separated values.
saveWrite sheets into an existing .xlsx, in place. It cannot create a new file.
Word documents
wordSections and page setup, the body text with --body, or the full structure as JSON with --extract.
commentsList the comments, resolve or reopen a thread, or reply to one.
revisionsList the tracked changes, or accept or reject them, all at once or one at a time.
Presentations
slidesList the slides with their titles and text, or write slides into an existing .pptx.
PDF
pdfinfo, merge, split, and protect: page and character counts, combine files, split at a page, or add a password.
Any format
loadA workbook's sheets with their formulas, a deck's slides, or a document's sections.
detectIdentify a document's type from its file extension.
validateOpen, save, and reopen a file or a folder of files, and report whether anything was lost.

Some commands change the file you name. save, slides --save, and pdf protect write to the file itself, and so do comments and revisions when they resolve, reply, accept, or reject, unless you add -o with a new file name.

Made for Scripts

The command is built on the same document engine as the app, and it behaves the way shell tools do.

  • Output is plain text, tab-separated values for a cell range, or JSON for a document's structure, so it works with awk, cut, jq, and the rest of your tools.
  • A failure, such as a missing file, prints a message to standard error and exits with status 1, so a script can stop on it.
  • A formula that cannot be evaluated prints an error value such as #VALUE!, as a spreadsheet cell would, and exits with status 0.
  • It reads and writes files itself, so it runs in scripts and scheduled jobs without the app open.

Terminal

$ lynxoffice formula '=SUM(A1:A3)' \
    --data '[["10"],["20"],["30"]]'
60

$ lynxoffice comments "Green Coffee Contract.docx"
Comments in Green Coffee Contract.docx:
  • #0 Ana Ruiz: Twenty-one days matches our export schedule.
  • #1 Tom Hale: We need the harvest date on the label as well.

$ lynxoffice word "Green Coffee Contract.docx" --extract \
    | jq -r '.body[] | select(.runs[0].formatting.bold) | .text'
2. Quality and rejection
3. Provenance records

$ lynxoffice pdf info "Green Coffee Contract.pdf"
Pages: 1
Characters: 1662
Has text: true

Install

  1. 1

    Install the command

    lynxoffice is a separate program that needs macOS 14 or later. Install it with Homebrew: brew install lynxoffice/tap/lynxoffice

    Every release is also on GitHub, signed with KDAN's Developer ID, notarized by Apple, and listed with its SHA-256 checksum. Homebrew is the simpler way to install it and keep it up to date.

  2. 2

    Run it

    Open Terminal and run lynxoffice help for every command, with its options and an example of each.

Frequently Asked Questions

How do I install it?

Install it with Homebrew, by running brew install lynxoffice/tap/lynxoffice in Terminal. It is a separate program and needs macOS 14 or later. Every release is also on GitHub, at github.com/LynxOffice/lynxoffice-cli-mac, signed with KDAN's Developer ID and notarized by Apple.

Does LynxOffice need to be open?

No. The command reads and writes files itself, so it works in scripts and scheduled jobs whether or not the app is running.

What does it print, and how do errors look?

Plain text by default, tab-separated values for a cell range, and JSON for a document's structure. A failure, such as a missing file, prints a message to standard error and exits with status 1.

Is it the same engine as the app?

Yes. The command-line tool is built on the same document engine as the app and the MCP server. The tool cards on the app's Home screen name the command that does the same job.

Free During Early Release

Download LynxOffice, open any document, and try the six AI tools.

Download on the Mac App Store

macOS 13 or later · Universal