OfficeCLI

OfficeCLI is the world's first and the best Office suite designed for AI agents.

Give any AI agent full control over Word, Excel, and PowerPoint — in one line of code.

Open-source. Single binary. No Office installation. No dependencies. Works everywhere.

OfficeCLI's built-in HTML rendering engine reproduces documents with high fidelity — and that's what gives AI eyes. It renders .docx / .xlsx / .pptx to HTML or PNG, closing the render → look → fix loop.

GitHub Release

License

English | 中文 | 日本語 | 한국어

中文

日本語

한국어

🌐 Website: officecli.ai  |  💬 Community: Discord

officecli.ai

Discord

OfficeCLI creating a PowerPoint presentation on AionUi

PPT creation process using OfficeCLI on AionUi

AionUi

PowerPoint Presentations

OfficeCLI design presentation (PowerPoint)

OfficeCLI business presentation (PowerPoint)

OfficeCLI tech presentation (PowerPoint)

OfficeCLI space presentation (PowerPoint)

OfficeCLI gaming presentation (PowerPoint)

OfficeCLI creative presentation (PowerPoint)

Word Documents

OfficeCLI academic paper (Word)

OfficeCLI project proposal (Word)

OfficeCLI annual report (Word)

Excel Spreadsheets

OfficeCLI budget tracker (Excel)

OfficeCLI gradebook (Excel)

OfficeCLI sales dashboard (Excel)

All documents above were created entirely by AI agents using OfficeCLI — no templates, no manual editing.

For AI Agents — Get Started in One Line

Paste this into your AI agent's chat — it will read the skill file and install everything automatically:

That's it. The skill file teaches the agent how to install the binary and use all commands.

For Humans

Option A — GUI: Install AionUi — a desktop app that lets you create and edit Office documents through natural language, powered by OfficeCLI under the hood. Just describe what you want, and AionUi handles the rest.

AionUi

Option B — CLI: Download the binary for your platform from GitHub Releases, then run:

GitHub Releases

This copies the binary to your PATH and installs the officecli skill into every AI coding agent it detects — Claude Code, Cursor, Windsurf, GitHub Copilot, and more. Your agent can immediately create, read, and edit Office documents on your behalf, no extra configuration needed.

For Developers — See It Live in 30 Seconds

That's it. Every add, set, or remove command you run will refresh the preview in real time. Keep experimenting — the browser is your live feedback loop.

Quick Start

Why OfficeCLI?

What used to take 50 lines of Python and 3 separate libraries:

Now takes one command:

What OfficeCLI can do:

Create documents from scratch -- blank or with content

Read text, structure, styles, formulas -- in plain text or structured JSON

Analyze formatting issues, style inconsistencies, and structural problems

Modify any element -- text, fonts, colors, layout, formulas, charts, images

Reorganize content -- add, remove, move, copy elements across documents

Word — full i18n & RTL support (per-script font slots, per-script BCP-47 lang tags lang.latin/ea/cs, complex-script bold/italic/size, direction=rtl cascading through paragraph/run/section/table/style/header/footer/docDefaults, rtlGutter + pgBorders shorthand, locale-aware page numbering for Hindi/Arabic/Thai/CJK; create --locale ar-SA auto-enables RTL), paragraphs (framePr, tabs shorthand, char-based indents), runs (underline.color, position half-pts), tables (virtual column ops add/remove/move/copyfrom, hMerge), styles, textbox / shape (textbox: rotation, textDirection eaVert/vert270, gradient, shadow, opacity), headers/footers, images (PNG/JPG/GIF/SVG), equations (LaTeX input), diagrams (mermaid → native editable shapes, or any mermaid type as a full-fidelity PNG), comments, footnotes, watermarks, bookmarks, TOC, charts, hyperlinks, sections, form fields, content controls (SDT), fields (22 zero-param types + MERGEFIELD / REF / PAGEREF / SEQ / STYLEREF / DOCPROPERTY / IF), OLE objects, revisions / tracked changes (revision.type=ins\|del\|format\|moveFrom\|moveTo + revision.action=accept\|reject, per-target /revision[@author=Alice] selector, tracked Find&Replace), page background color, document properties

i18n & RTL support

paragraphs

runs

tables

styles

textbox

shape

headers/footers

images

equations

diagrams

comments

footnotes

watermarks

bookmarks

TOC

charts

hyperlinks

sections

form fields

content controls (SDT)

fields

OLE objects

revisions / tracked changes

document properties

Excel — cells (phonetic guide / furigana on add, Excel-UI --shift left\|up on remove / shift=right\|down on add), formulas (350+ built-in functions with auto-evaluation, spilling dynamic arrays with _xlfn. auto-prefix, financial / bond and statistical families, OFFSET/INDIRECT, defined-name formula bodies inlined at parse, formula-ref rewrite on row/col insert), sheets (visible/hidden/veryHidden, print margins, printTitleRows/Cols, RTL sheetView, cascade-aware sheet rename, empty-cell bloat filter on open), boolean and/or selectors (row[Salary>5000 and Region=EMEA]), tables, sort (sheet / range, multi-key, sidecar-aware), conditional formatting, charts (including box-whisker, pareto with auto-sort + cumulative-%, log axis), pivot tables (multi-field, date grouping, showDataAs, sort, grandTotals, subtotals, compact/outline/tabular layout, repeat item labels, blank rows, calculated fields, persistent labelFilter / topN filters, cache CoW + cross-pivot sharing), slicers, named ranges, data validation, images (PNG/JPG/GIF/SVG with dual-representation fallback), sparklines, comments (RTL), autofilter, shapes, OLE objects, CSV/TSV import, $Sheet:A1 cell addressing

cells

sheets

tables

sort

conditional formatting

charts

pareto

pivot tables

slicers

named ranges

data validation

images

sparklines

comments

autofilter

shapes

OLE objects

PowerPoint — slides (header/footer/date/slidenum toggles, hidden), shapes (pattern fill, blur effect, hyperlink tooltip + slide-jump links, highlight color on runs, slideMaster/slideLayout typed add/set/remove, arrow alias, effective.X + effective.X.src), images (PNG/JPG/GIF/SVG, fill modes: stretch/contain/cover/tile, brightness/contrast/glow/shadow, rotation, link + tooltip), tables (built-in PowerPoint style catalogue, virtual /col[C] get + swap/copyFrom, row/col Move/CopyFrom, fill/background alias), charts (pieOfPie, barOfPie, per-attr axisLine/gridline setters, series add/remove with theme palette, anchor=x,y,w,h shorthand), animations (15 emphasis + 16 exit template-backed presets, multi-effect chains, motion-path presets, repeat/restart/autoReverse, chart animations + chartBuild), transitions (morph + p14 + 12 p15 PowerPoint 2013+ presets), 3D models (.glb) (combined rotation=ax,ay,az), slide zoom, equations (LaTeX input), diagrams (mermaid flowchart / sequence → native editable shapes, or any mermaid type as a full-fidelity PNG), themes, connectors (from/to accept a full /slide[N]/shape[@name=Foo] path), video/audio (loop, autoStart), groups (link + tooltip; Get/Query/Add/Remove all descend into groups), notes (RTL, lang), comments (RTL, legacy + modern p188 threaded round-trip), SmartArt (round-trip via add-part + raw-set), OLE objects, placeholders (add/set by phType)

slides

shapes

images

tables

charts

animations

transitions

3D models (.glb)

slide zoom

equations

diagrams

themes

connectors

video/audio

groups

notes

comments

OLE objects

placeholders

Use Cases

For Developers:

Automate report generation from databases or APIs

Batch-process documents (bulk find/replace, style updates)

Build document pipelines in CI/CD environments (generate docs from test results)

Headless Office automation in Docker/containerized environments

For AI Agents:

Generate presentations from user prompts (see examples above)

Extract structured data from documents to JSON

Validate and check document quality before delivery

For Teams:

Clone document templates and populate with data

Automated document validation in CI/CD pipelines

Installation

Ships as a single self-contained binary. The .NET runtime is embedded -- nothing to install, no runtime to manage.

One-line install:

Or via a package manager:

Or download manually from GitHub Releases:

GitHub Releases

Verify installation: officecli --version

Or self-install from a downloaded binary (or run bare officecli to auto-install):

Updates are checked automatically in the background. Disable with officecli config autoUpdate false or skip per-invocation with OFFICECLI_SKIP_UPDATE=1. Configuration lives under ~/.officecli/config.json.

Key Features

Built-in Engines & Generation Primitives

OfficeCLI is self-contained. The capabilities below ship inside the binary — no Office required.

Rendering engine — high-fidelity, built-in

OfficeCLI's keystone: a from-scratch, high-fidelity HTML rendering engine that lets an AI agent see the rendered document instead of guessing from the DOM. It covers shapes, charts (trendlines, error bars, waterfall, candlestick, sparklines), equations (OMML → MathJax-compatible), 3D .glb models via Three.js, morph transitions, slide zoom, and shape effects. Per-page PNG screenshots are produced by piping the rendered HTML through a headless browser. Three modes:

view html — standalone HTML file, assets inlined. Open in any browser.

view screenshot — per-page PNG, ready for multimodal agents to read.

watch — local HTTP server with auto-refreshing preview; every add / set / remove updates the browser instantly. Excel watch supports inline cell editing and drag-to-reposition charts.

Without visualization, an agent generating slides is flying blind — it can read the DOM but can't tell if the title overflows or two shapes overlap. Because rendering is built into the binary, the render → look → fix loop works in CI, in Docker, on a server with no display — anywhere the binary runs.

Formula & pivot engine

350+ built-in Excel functions evaluated automatically on write — write =SUM(A1:A2), get the cell, the value is already there. No round-trip through Office to recalc. Covers spilling dynamic arrays (FILTER / SORT / UNIQUE / SEQUENCE / LET / LAMBDA / MAP), VLOOKUP / XLOOKUP / INDEX / MATCH, financial & bond math (XIRR / PRICE / YIELD / DURATION / COUPNUM), statistical distributions, tests & regression (NORM.DIST / T.TEST / LINEST), and date & text functions.

Plus native OOXML pivot tables from a source range with one command — multi-field rows/cols/filters, 10 aggregations, showDataAs modes, date grouping, calculated fields, top-N, layouts. Pivot cache + definition are written to OOXML, so Excel opens the file with the aggregation already populated:

Template merge — generate once, fill many

merge replaces {{key}} placeholders in any .docx / .xlsx / .pptx with JSON data — across paragraphs, table cells, shapes, headers, footers, and chart titles. Agent designs the layout once (expensive); production code fills it N times (cheap, deterministic, zero token cost). Avoids the failure mode where an agent regenerates each report from scratch and produces N inconsistent layouts.

Round-trip dump — learn from existing docs

dump serializes any .docx, .pptx, or .xlsx — whole document or any subtree (a single paragraph, table, slide, worksheet, the styles part, numbering, theme, or settings) — into a replayable batch JSON; batch replays it. Given a sample the user wants to imitate, an agent reads the structured spec instead of raw OOXML XML, mutates, and replays. Bridges "I have an existing template" and "generate me 100 variations."

Resident Mode & Batch

For multi-step workflows, resident mode keeps the document in memory. Batch mode applies multiple operations in a single pass.

Reading the file with another tool? Flush to disk first.

officecli's own reads (get/query/view) always see your latest edits, so within officecli you never need to save. But a live resident defers the disk write, so before a non‑officecli program reads the file — python‑docx/openpyxl, Microsoft Word, a renderer, delivery/upload — flush it:

A live resident also auto‑flushes shortly after going idle (adaptive 2–10s, scaled to the document's measured save cost). For a pipeline where another program reads after every command, set OFFICECLI_RESIDENT_FLUSH=each — every mutation is on disk before the command returns, while the resident stays warm. Full flush model (each/auto/fixed/off, save / close, env tuning): wiki → open / close.

wiki → open / close

Three-Layer Architecture

Start simple, go deep only when needed.

AI Integration

MCP Server

Built-in MCP server — register with one command:

MCP

Exposes all document operations as tools over JSON-RPC — no shell access needed.

Direct CLI Integration

Get OfficeCLI working with your AI agent in two steps:

Install the binary -- one command (see Installation)

Installation

Done. OfficeCLI automatically detects your AI tools (Claude Code, GitHub Copilot, Codex) by checking known config directories and installs its skill file. Your agent can immediately create, read, and modify any Office document.

If auto-install doesn't cover your setup, you can install the skill file manually:

Feed SKILL.md to your agent directly:

Install as a local skill for Claude Code:

Other agents: Include the contents of SKILL.md in your agent's system prompt or tool description.

Why your agent will thrive on OfficeCLI

Deterministic JSON output — every command supports --json with consistent schemas. No regex parsing, no scraping stdout.

Path-based addressing — every element has a stable path (/slide[1]/shape[2]). Agents navigate documents without understanding XML namespaces. (OfficeCLI syntax: 1-based indexing, element local names — not XPath.)

Progressive complexity (L1 → L2 → L3) — agents start with read-only views, escalate to DOM ops, fall back to raw XML only when needed. Minimizes token usage.

Self-healing workflow — validate, view issues, and the structured error codes (not_found, invalid_value, unsupported_property) return suggestions and valid ranges. Agents self-correct without human intervention.

Built-in agent-friendly rendering engine — view html / view screenshot / watch emit HTML and PNG natively. No Office required. Agents can see their output and fix layout issues, even inside CI / Docker / headless environments.

Built-in formula & pivot engine — 350+ Excel functions auto-evaluated on write (incl. spilling dynamic arrays, financial / bond and statistical families); native OOXML pivot tables from a source range with one command. Agents read computed values and shipped aggregations immediately, without round-tripping through Office.

Template merge — agent designs the layout once, downstream code fills {{key}} placeholders N times. Avoids burning tokens regenerating every report from scratch.

Round-trip dump — dump turns any .docx, .pptx, or .xlsx into replayable batch JSON. Agents learn from human-authored samples by reading a structured spec, not raw OOXML XML.

Built-in help — when unsure about property names or value formats, the agent runs officecli <format> set <element> instead of guessing.

Auto-install — OfficeCLI detects your AI tooling (Claude Code, Cursor, VS Code, …) and configures itself. No manual skill-file setup.

Built-in Help

Don't guess property names — drill into the help:

Run officecli --help for the full overview.

JSON Output Schemas

All commands support --json. The general response shapes:

Single element (get --json):

List of elements (query --json):

Errors return a non-zero exit code with a structured error object including error code, suggestion, and valid values when available:

Error codes: not_found, invalid_value, unsupported_property, invalid_path, unsupported_type, missing_property, file_not_found, file_locked, invalid_selector. Property names are auto-corrected -- misspelling a property returns a suggestion with the closest match.

Error Recovery -- Agents self-correct by inspecting available elements:

Mutation confirmations (set, add, remove, move, create with --json):

See officecli --help for full details on exit codes and error formats.

Comparison

Command Reference

create

view

load_skill

get

query

set

add

remove

move

swap

validate

batch

dump

refresh

plugins

merge

watch

mcp

raw

raw-set

open

install

Built-in help

End-to-End Workflow Example

A typical self-healing agent workflow: create a presentation, populate it, verify, and fix issues -- all without human intervention.

Units & Colors

All dimension and color properties accept flexible input formats:

Common Patterns

From Python or Node.js — install one of the thin resident-pipe SDKs (no per-call process spawn):

Both SDKs auto-provision the native CLI when missing (mirror-first, Windows-capable) and announce the install rather than doing it silently.

Or wrap subprocess directly, one-shot:

Documentation

The Wiki has detailed guides for every command, element type, and property:

Wiki

By format: Word | Excel | PowerPoint

Word

Excel

PowerPoint

Workflows: End-to-end examples -- Word reports, Excel dashboards, PowerPoint decks, batch modifications, resident mode

End-to-end examples

Runnable examples: examples/ -- copy-paste scripts (.sh/.py) for Word, Excel, and PowerPoint, with output files included

examples/

Troubleshooting: Common errors and solutions

Common errors and solutions

AI agent guide: Decision tree for navigating the wiki

Decision tree for navigating the wiki

Build from Source

Requires .NET 10 SDK for compilation only. The output is a self-contained, native binary -- .NET is embedded in the binary and is not needed at runtime.

.NET 10 SDK

License

Apache License 2.0

Apache License 2.0

Bug reports and contributions are welcome on GitHub Issues.

GitHub Issues

If you find OfficeCLI useful, please give it a star on GitHub — it helps others discover the project.

give it a star on GitHub

OfficeCLI.AI | GitHub

OfficeCLI.AI

GitHub