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.
π Website: officecli.ai | π¬ Community: Discord
PPT creation process using OfficeCLI on AionUi
PowerPoint Presentations
β
Word Documents
β
Excel Spreadsheets
All documents above were created entirely by AI agents using OfficeCLI β no templates, no manual editing.
Paste this into your AI agent's chat β it will read the skill file and install everything automatically:
curl -fsSL https://officecli.ai/SKILL.md
That's it. The skill file teaches the agent how to install the binary and use all commands.
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.
Option B β CLI: Download the binary for your platform from GitHub Releases, then run:
officecli install
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.
curl -fsSL https://raw.githubusercontent.com/iOfficeAI/OfficeCLI/main/install.sh | bash
officecli create deck.pptx
officecli watch deck.pptx
officecli add deck.pptx / --type slide --prop title="Hello, World!"
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.
officecli create deck.pptx
officecli add deck.pptx / --type slide --prop title="Q4 Report" --prop background=1A1A2E
officecli add deck.pptx '/slide[1]' --type shape \
--prop text="Revenue grew 25%" --prop x=2cm --prop y=5cm \
--prop font=Arial --prop size=24 --prop color=FFFFFF
officecli view deck.pptx outline
officecli view deck.pptx html
officecli get deck.pptx '/slide[1]/shape[1]' --json
officecli close deck.pptx
{
"tag": "shape",
"path": "/slide[1]/shape[1]",
"attributes": {
"name": "TextBox 1",
"text": "Revenue grew 25%",
"x": "720000",
"y": "1800000"
}
}
What used to take 50 lines of Python and 3 separate libraries:
from pptx import Presentation
from pptx.util import Inches, Pt
prs = Presentation()
slide = prs.slides.add_slide(prs.slide_layouts[0])
title = slide.shapes.title
title.text = "Q4 Report"
prs.save('deck.pptx')
Now takes one command:
officecli add deck.pptx / --type slide --prop title="Q4 Report"
What OfficeCLI can do:
Create documents from scratch -- blank or with contentRead text, structure, styles, formulas -- in plain text or structured JSONAnalyze formatting issues, style inconsistencies, and structural problemsModify any element -- text, fonts, colors, layout, formulas, charts, imagesReorganize content -- add, remove, move, copy elements across documents
| Format | Read | Modify | Create |
|---|---|---|---|
| Word (.docx) | β | β | β |
| Excel (.xlsx) | β | β | β |
| PowerPoint (.pptx) | β | β | β |
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
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
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)
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
Ships as a single self-contained binary. The .NET runtime is embedded -- nothing to install, no runtime to manage.
One-line install:
curl -fsSL https://raw.githubusercontent.com/iOfficeAI/OfficeCLI/main/install.sh | bash
irm https://raw.githubusercontent.com/iOfficeAI/OfficeCLI/main/install.ps1 | iex
Or download manually from GitHub Releases:
| Platform | Binary |
|---|---|
| macOS Apple Silicon | officecli-mac-arm64 |
| macOS Intel | officecli-mac-x64 |
| Linux x64 | officecli-linux-x64 |
| Linux ARM64 | officecli-linux-arm64 |
| Windows x64 | officecli-win-x64.exe |
| Windows ARM64 | officecli-win-arm64.exe |
Verify installation: officecli --version
Or self-install from a downloaded binary (or run bare officecli to auto-install):
officecli install # explicit
officecli # bare invocation also triggers 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
.
OfficeCLI is self-contained. The capabilities below ship inside the binary β no Office required.
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:
β standalone HTML file, assets inlined. Open in any browser.view html
β per-page PNG, ready for multimodal agents to read.view screenshot
β local HTTP server with auto-refreshing preview; everywatch
add
/set
/remove
updates the browser instantly. Excel watch supports inline cell editing and drag-to-reposition charts.
officecli view deck.pptx html -o /tmp/deck.html
officecli view deck.pptx screenshot -o /tmp/deck.png # add --page 1-N for more slides
officecli watch deck.pptx # http://localhost:26315
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 β fixloop works in CI, in Docker, on a server with no display β anywhere the binary runs.
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:
officecli add sales.xlsx '/Sheet1' --type pivottable \
--prop source='Data!A1:E10000' --prop rows='Region,Category' \
--prop cols=Quarter --prop values='Revenue:sum,Units:avg' \
--prop showDataAs=percentOfTotal
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.
officecli merge invoice-template.docx out-001.docx '{"client":"Acme","total":"$5,200"}'
officecli merge q4-template.pptx q4-acme.pptx data.json
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."
officecli dump existing.docx -o blueprint.json # whole document
officecli dump existing.docx /body/tbl[1] -o table.json # any subtree
officecli dump existing.xlsx /Sheet1 -o sheet.json # a single worksheet
officecli batch new.docx --input blueprint.json
For multi-step workflows, resident mode keeps the document in memory. Batch mode applies multiple operations in a single pass.
officecli open report.docx
officecli set report.docx /body/p[1]/r[1] --prop bold=true
officecli set report.docx /body/p[2]/r[1] --prop color=FF0000
officecli close report.docx
echo '[{"command":"set","path":"/slide[1]/shape[1]","props":{"text":"Hello"}},
{"command":"set","path":"/slide[1]/shape[2]","props":{"fill":"FF0000"}}]' \
| officecli batch deck.pptx --json
officecli batch deck.pptx --commands '[{"op":"set","path":"/slide[1]/shape[1]","props":{"text":"Hi"}}]'
officecli batch deck.pptx --input updates.json --stop-on-error --json
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, sobefore a nonβofficecli program reads the fileβ pythonβdocx/openpyxl, Microsoft Word, a renderer, delivery/upload β flush it:
officecli set report.docx /body/p[1] --prop bold=true
officecli save report.docx # flush, keep the resident warm (or `close` to flush + release)
python my_reader.py report.docx # now sees the edit
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].
Start simple, go deep only when needed.
| Layer | Purpose | Commands |
|---|---|---|
| L1: Read | ||
| Semantic views of content | view (text, annotated, outline, stats, issues, html, svg, screenshot) |
|
| L2: DOM | ||
| Structured element operations | get , query , set , add , remove , move , swap |
|
| L3: Raw XML | ||
| Direct XPath access β universal fallback | raw , raw-set , add-part , validate |
officecli view report.docx annotated
officecli view budget.xlsx text --cols A,B,C --max-lines 50
officecli query report.docx "run:contains(TODO)"
officecli add budget.xlsx / --type sheet --prop name="Q2 Report"
officecli move report.docx /body/p[5] --to /body --index 1
officecli raw deck.pptx '/slide[1]'
officecli raw-set report.docx document \
--xpath "//w:p[1]" --action append \
--xml '<w:r><w:t>Injected text</w:t></w:r>'
Built-in MCP server β register with one command:
officecli mcp claude # Claude Code
officecli mcp cursor # Cursor
officecli mcp vscode # VS Code / Copilot
officecli mcp lmstudio # LM Studio
officecli mcp list # Check registration status
Exposes all document operations as tools over JSON-RPC β no shell access needed.
Get OfficeCLI working with your AI agent in two steps:
Install the binary-- one command (seeInstallation)** 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.
Manual setup (optional)
If auto-install doesn't cover your setup, you can install the skill file manually:
Feed SKILL.md to your agent directly:
curl -fsSL https://officecli.ai/SKILL.md
Install as a local skill for Claude Code:
curl -fsSL https://officecli.ai/SKILL.md -o ~/.claude/skills/officecli.md
Other agents: Include the contents of SKILL.md
in your agent's system prompt or tool description.
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 canseetheir 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 runsofficecli <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.
Don't guess property names β drill into the help:
officecli pptx set # All settable elements and properties
officecli pptx set shape # Detail for one element type
officecli pptx set shape.fill # One property: format and examples
officecli docx query # Selector reference: attributes, :contains, :has(), etc.
Run officecli --help
for the full overview.
All commands support --json
. The general response shapes:
Single element (get --json
):
{"tag": "shape", "path": "/slide[1]/shape[1]", "attributes": {"name": "TextBox 1", "text": "Hello"}}
List of elements (query --json
):
[
{"tag": "paragraph", "path": "/body/p[1]", "attributes": {"style": "Heading1", "text": "Title"}},
{"tag": "paragraph", "path": "/body/p[5]", "attributes": {"style": "Heading1", "text": "Summary"}}
]
Errors return a non-zero exit code with a structured error object including error code, suggestion, and valid values when available:
{
"success": false,
"error": {
"error": "Slide 50 not found (total: 8)",
"code": "not_found",
"suggestion": "Valid Slide index range: 1-8"
}
}
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:
officecli get report.docx /body/p[99] --json
officecli get report.docx /body --depth 1 --json
Mutation confirmations (set
, add
, remove
, move
, create
with --json
):
{"success": true, "path": "/slide[1]/shape[1]"}
See officecli --help
for full details on exit codes and error formats.
| OfficeCLI | Microsoft Office | LibreOffice | python-docx / openpyxl | |
|---|---|---|---|---|
| Open source & free | β (Apache 2.0) | β (paid license) | β | β |
| AI-native CLI + JSON | β | β | β | β |
| Zero install (single binary) | β | β | β | β (Python + pip) |
| Call from any language | β (CLI) | β (COM/Add-in) | β (UNO API) | Python only |
| Path-based element access | β | β | β | β |
| Raw XML fallback | β | β | β | Partial |
| Built-in agent-friendly rendering engine | β | β | β | β |
| Headless HTML/PNG output | β | β | Partial | β |
Template merge ({{key}} ) across formats |
||||
| β | β | β | β | |
| Round-trip dump β batch JSON | β | β | β | β |
| Live preview (auto-refresh on edit) | β | β | β | β |
| Headless / CI | β | β | Partial | β |
| Cross-platform | β | Windows/Mac | β | β |
| Word + Excel + PowerPoint | β | β | β | Separate libs |
| Command | Description |
|---|---|
create |
view
outline
, text
, annotated
, stats
(--page-count
), issues
, html
, svg
, screenshot
, pdf
(via exporter plugin), forms
(via format-handler plugin)). docx supports --render auto|native|html
.load_skill
get
--depth N
, --json
)query
and
/or
, row-by-column-name (row[Salary>5000]
), --find
flagset
get
/query
), --find
/--replace
flagsadd
--from <path>
)remove
move
--to <parent>
, --index N
, --after <path>
, --before <path>
)swap
validate
view <file> issues
batch
--input
, or --commands
; continues on error by default, --stop-on-error
to abort)dump
.docx
, .pptx
, or .xlsx
into a replayable batch JSON (round-trip via batch
); accepts a subtree pathrefresh
PAGE
/ cross-references (.docx
; Word backend on Windows, headless-HTML fallback)plugins
.doc
, .hwpx
, .pdf
export via dump-reader / exporter / format-handler kinds)merge
{{key}}
placeholders with JSON datawatch
mcp
raw
raw-set
add-part
open
close
install
all
, claude
, cursor
, etc.)config
<format> <command>
Built-in help(e.g.officecli pptx set shape
)A typical self-healing agent workflow: create a presentation, populate it, verify, and fix issues -- all without human intervention.
officecli create report.pptx
officecli add report.pptx / --type slide --prop title="Q4 Results"
officecli add report.pptx '/slide[1]' --type shape \
--prop text="Revenue: $4.2M" --prop x=2cm --prop y=5cm --prop size=28
officecli add report.pptx / --type slide --prop title="Details"
officecli add report.pptx '/slide[2]' --type shape \
--prop text="Growth driven by new markets" --prop x=2cm --prop y=5cm
officecli view report.pptx outline
officecli validate report.pptx
officecli view report.pptx issues --json
officecli set report.pptx '/slide[1]/shape[1]' --prop font=Arial
All dimension and color properties accept flexible input formats:
| Type | Accepted formats | Examples |
|---|---|---|
| Dimensions | ||
| cm, in, pt, px, or raw EMU | 2cm , 1in , 72pt , 96px , 914400 |
|
| Colors | ||
| Hex, named, RGB, theme | #FF0000 , FF0000 , red , rgb(255,0,0) , accent1 |
|
| Font sizes | ||
| Bare number or pt-suffixed | 14 , 14pt , 10.5pt |
|
| Spacing | ||
| pt, cm, in, or multiplier | 12pt , 0.5cm , 1.5x , 150% |
officecli query report.docx "paragraph[style=Heading1]" --json | ...
officecli set report.docx /body/p[1]/r[1] --prop text="New Title"
officecli get deck.pptx / --depth 2 --json
officecli batch budget.xlsx --input updates.json --json
officecli add budget.xlsx / --type sheet --prop name="Q1 Data" --prop csv=sales.csv
officecli merge invoice-template.docx invoice-001.docx '{"client":"Acme","total":"$5,200"}'
officecli validate report.docx && officecli view report.docx issues --json
From Python or Node.js β install one of the thin resident-pipe SDKs (no per-call process spawn):
from officecli import Doc
with Doc("deck.pptx") as d:
d.add("/", type="slide", title="Q4 Report")
print(d.get("/slide[1]"))
js
// Node.js β `npm install @officecli/sdk`
import { Doc } from "@officecli/sdk";
await using d = await Doc.open("deck.pptx");
await d.add("/", { type: "slide", title: "Q4 Report" });
console.log(await d.get("/slide[1]"));
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:
import json, subprocess
def cli(*args):
return json.loads(subprocess.check_output(["officecli", *args, "--json"], text=True))
cli("create", "deck.pptx")
The Wiki has detailed guides for every command, element type, and property:
By format:Word|Excel|PowerPointWorkflows:End-to-end examples-- Word reports, Excel dashboards, PowerPoint decks, batch modifications, resident modeRunnable examples:examples/-- copy-paste scripts (.sh/.py) for Word, Excel, and PowerPoint, with output files includedTroubleshooting:Common errors and solutions** AI agent guide:**Decision tree for navigating the wiki
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.
./build.sh
Bug reports and contributions are welcome on GitHub Issues.
If you find OfficeCLI useful, please give it a star on GitHub β it helps others discover the project.