{"slug": "officecli-office-suite-for-ai-agents-to-read-and-edit-microsoft-office-files", "title": "OfficeCLI: Office suite for AI agents to read and edit Microsoft Office files", "summary": "OfficeCLI, an open-source command-line tool, enables AI agents to create, read, and edit Microsoft Office files (Word, Excel, PowerPoint) without requiring an Office installation. The tool uses an HTML rendering engine for high-fidelity document preview and supports a live feedback loop for AI-driven editing. It aims to simplify Office automation for AI agents with a single binary and no dependencies.", "body_md": "OfficeCLI is the world's first and the best Office suite designed for AI agents.\n\n**Give any AI agent full control over Word, Excel, and PowerPoint — in one line of code.**\n\nOpen-source. Single binary. No Office installation. No dependencies. Works everywhere.\n\n**OfficeCLI's built-in HTML rendering engine reproduces documents with high fidelity — and that's what gives AI eyes.** It renders `.docx`\n\n/ `.xlsx`\n\n/ `.pptx`\n\nto HTML or PNG, closing the *render → look → fix* loop.\n\n**🌐 Website:** [officecli.ai](https://officecli.ai) | **💬 Community:** [Discord](https://discord.gg/2QAwJn7Egx)\n\n*PPT creation process using OfficeCLI on AionUi*\n\n**PowerPoint Presentations**\n\n—\n\n**Word Documents**\n\n—\n\n**Excel Spreadsheets**\n\n*All documents above were created entirely by AI agents using OfficeCLI — no templates, no manual editing.*\n\nPaste this into your AI agent's chat — it will read the skill file and install everything automatically:\n\n```\ncurl -fsSL https://officecli.ai/SKILL.md\n```\n\nThat's it. The skill file teaches the agent how to install the binary and use all commands.\n\n**Option A — GUI:** Install [ AionUi](https://github.com/iOfficeAI/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.\n\n**Option B — CLI:** Download the binary for your platform from [GitHub Releases](https://github.com/iOfficeAI/OfficeCLI/releases), then run:\n\n```\nofficecli install\n```\n\nThis 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.\n\n```\n# 1. Install (macOS / Linux)\ncurl -fsSL https://raw.githubusercontent.com/iOfficeAI/OfficeCLI/main/install.sh | bash\n# Windows (PowerShell): irm https://raw.githubusercontent.com/iOfficeAI/OfficeCLI/main/install.ps1 | iex\n\n# 2. Create a blank PowerPoint\nofficecli create deck.pptx\n\n# 3. Start live preview — opens http://localhost:26315 in your browser\nofficecli watch deck.pptx\n\n# 4. Open another terminal, add a slide — watch the browser update instantly\nofficecli add deck.pptx / --type slide --prop title=\"Hello, World!\"\n```\n\nThat's it. Every `add`\n\n, `set`\n\n, or `remove`\n\ncommand you run will refresh the preview in real time. Keep experimenting — the browser is your live feedback loop.\n\n```\n# Create a presentation and add content\nofficecli create deck.pptx\nofficecli add deck.pptx / --type slide --prop title=\"Q4 Report\" --prop background=1A1A2E\nofficecli add deck.pptx '/slide[1]' --type shape \\\n  --prop text=\"Revenue grew 25%\" --prop x=2cm --prop y=5cm \\\n  --prop font=Arial --prop size=24 --prop color=FFFFFF\n\n# View as outline\nofficecli view deck.pptx outline\n# → Slide 1: Q4 Report\n# →   Shape 1 [TextBox]: Revenue grew 25%\n\n# View as HTML — opens a rendered preview in your browser, no server needed\nofficecli view deck.pptx html\n\n# Get structured JSON for any element\nofficecli get deck.pptx '/slide[1]/shape[1]' --json\n\n# Save and close — flushes the resident session to disk\nofficecli close deck.pptx\n{\n  \"tag\": \"shape\",\n  \"path\": \"/slide[1]/shape[1]\",\n  \"attributes\": {\n    \"name\": \"TextBox 1\",\n    \"text\": \"Revenue grew 25%\",\n    \"x\": \"720000\",\n    \"y\": \"1800000\"\n  }\n}\n```\n\nWhat used to take 50 lines of Python and 3 separate libraries:\n\n``` python\nfrom pptx import Presentation\nfrom pptx.util import Inches, Pt\nprs = Presentation()\nslide = prs.slides.add_slide(prs.slide_layouts[0])\ntitle = slide.shapes.title\ntitle.text = \"Q4 Report\"\n# ... 45 more lines ...\nprs.save('deck.pptx')\n```\n\nNow takes one command:\n\n```\nofficecli add deck.pptx / --type slide --prop title=\"Q4 Report\"\n```\n\n**What OfficeCLI can do:**\n\n**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\n\n| Format | Read | Modify | Create |\n|---|---|---|---|\n| Word (.docx) | ✅ | ✅ | ✅ |\n| Excel (.xlsx) | ✅ | ✅ | ✅ |\n| PowerPoint (.pptx) | ✅ | ✅ | ✅ |\n\n**Word** — full [i18n & RTL support](https://github.com/iOfficeAI/OfficeCLI/wiki/i18n) (per-script font slots, per-script BCP-47 lang tags `lang.latin/ea/cs`\n\n, complex-script bold/italic/size, `direction=rtl`\n\ncascading through paragraph/run/section/table/style/header/footer/docDefaults, `rtlGutter`\n\n+ `pgBorders`\n\nshorthand, locale-aware page numbering for Hindi/Arabic/Thai/CJK; `create --locale ar-SA`\n\nauto-enables RTL), [paragraphs](https://github.com/iOfficeAI/OfficeCLI/wiki/word-paragraph) (framePr, tabs shorthand, char-based indents), [runs](https://github.com/iOfficeAI/OfficeCLI/wiki/word-run) (underline.color, position half-pts), [tables](https://github.com/iOfficeAI/OfficeCLI/wiki/word-table) (virtual column ops add/remove/move/copyfrom, hMerge), [styles](https://github.com/iOfficeAI/OfficeCLI/wiki/word-style), [textbox](https://github.com/iOfficeAI/OfficeCLI/wiki/word-textbox) / [shape](https://github.com/iOfficeAI/OfficeCLI/wiki/word-shape) (textbox: rotation, `textDirection`\n\n`eaVert`\n\n/`vert270`\n\n, gradient, shadow, opacity), [headers/footers](https://github.com/iOfficeAI/OfficeCLI/wiki/word-header-footer), [images](https://github.com/iOfficeAI/OfficeCLI/wiki/word-picture) (PNG/JPG/GIF/SVG), [equations](https://github.com/iOfficeAI/OfficeCLI/wiki/word-equation) (LaTeX input), [diagrams](https://github.com/iOfficeAI/OfficeCLI/wiki/diagram) (mermaid → native editable shapes, or any mermaid type as a full-fidelity PNG), [comments](https://github.com/iOfficeAI/OfficeCLI/wiki/word-comment), [footnotes](https://github.com/iOfficeAI/OfficeCLI/wiki/word-footnote), [watermarks](https://github.com/iOfficeAI/OfficeCLI/wiki/word-watermark), [bookmarks](https://github.com/iOfficeAI/OfficeCLI/wiki/word-bookmark), [TOC](https://github.com/iOfficeAI/OfficeCLI/wiki/word-toc), [charts](https://github.com/iOfficeAI/OfficeCLI/wiki/word-chart), [hyperlinks](https://github.com/iOfficeAI/OfficeCLI/wiki/word-hyperlink), [sections](https://github.com/iOfficeAI/OfficeCLI/wiki/word-section), [form fields](https://github.com/iOfficeAI/OfficeCLI/wiki/word-formfield), [content controls (SDT)](https://github.com/iOfficeAI/OfficeCLI/wiki/word-sdt), [fields](https://github.com/iOfficeAI/OfficeCLI/wiki/word-field) (22 zero-param types + MERGEFIELD / REF / PAGEREF / SEQ / STYLEREF / DOCPROPERTY / IF), [OLE objects](https://github.com/iOfficeAI/OfficeCLI/wiki/word-ole), [revisions / tracked changes](https://github.com/iOfficeAI/OfficeCLI/wiki/word-revision) (`revision.type=ins\\|del\\|format\\|moveFrom\\|moveTo`\n\n+ `revision.action=accept\\|reject`\n\n, per-target `/revision[@author=Alice]`\n\nselector, tracked Find&Replace), page background color, [document properties](https://github.com/iOfficeAI/OfficeCLI/wiki/word-document)\n\n**Excel** — [cells](https://github.com/iOfficeAI/OfficeCLI/wiki/excel-cell) (phonetic guide / furigana on add, Excel-UI `--shift left\\|up`\n\non remove / `shift=right\\|down`\n\non add), formulas (350+ built-in functions with auto-evaluation, spilling dynamic arrays with `_xlfn.`\n\nauto-prefix, financial / bond and statistical families, OFFSET/INDIRECT, defined-name formula bodies inlined at parse, formula-ref rewrite on row/col insert), [sheets](https://github.com/iOfficeAI/OfficeCLI/wiki/excel-sheet) (visible/hidden/veryHidden, print margins, printTitleRows/Cols, RTL `sheetView`\n\n, cascade-aware sheet rename, empty-cell bloat filter on open), boolean `and`\n\n/`or`\n\nselectors (`row[Salary>5000 and Region=EMEA]`\n\n), [tables](https://github.com/iOfficeAI/OfficeCLI/wiki/excel-table), [sort](https://github.com/iOfficeAI/OfficeCLI/wiki/excel-sort) (sheet / range, multi-key, sidecar-aware), [conditional formatting](https://github.com/iOfficeAI/OfficeCLI/wiki/excel-conditionalformatting), [charts](https://github.com/iOfficeAI/OfficeCLI/wiki/excel-chart) (including box-whisker, [pareto](https://github.com/iOfficeAI/OfficeCLI/wiki/excel-chart-add) with auto-sort + cumulative-%, log axis), [pivot tables](https://github.com/iOfficeAI/OfficeCLI/wiki/excel-pivottable) (multi-field, date grouping, showDataAs, sort, grandTotals, subtotals, compact/outline/tabular layout, repeat item labels, blank rows, calculated fields, persistent `labelFilter`\n\n/ `topN`\n\nfilters, cache CoW + cross-pivot sharing), [slicers](https://github.com/iOfficeAI/OfficeCLI/wiki/excel-slicer), [named ranges](https://github.com/iOfficeAI/OfficeCLI/wiki/excel-namedrange), [data validation](https://github.com/iOfficeAI/OfficeCLI/wiki/excel-validation), [images](https://github.com/iOfficeAI/OfficeCLI/wiki/excel-picture) (PNG/JPG/GIF/SVG with dual-representation fallback), [sparklines](https://github.com/iOfficeAI/OfficeCLI/wiki/excel-sparkline), [comments](https://github.com/iOfficeAI/OfficeCLI/wiki/excel-comment) (RTL), [autofilter](https://github.com/iOfficeAI/OfficeCLI/wiki/excel-autofilter), [shapes](https://github.com/iOfficeAI/OfficeCLI/wiki/excel-shape), [OLE objects](https://github.com/iOfficeAI/OfficeCLI/wiki/excel-ole), CSV/TSV import, `$Sheet:A1`\n\ncell addressing\n\n**PowerPoint** — [slides](https://github.com/iOfficeAI/OfficeCLI/wiki/ppt-slide) (header/footer/date/slidenum toggles, hidden), [shapes](https://github.com/iOfficeAI/OfficeCLI/wiki/ppt-shape) (pattern fill, blur effect, hyperlink tooltip + slide-jump links, **highlight color** on runs, `slideMaster`\n\n/`slideLayout`\n\ntyped add/set/remove, arrow alias, effective.X + effective.X.src), [images](https://github.com/iOfficeAI/OfficeCLI/wiki/ppt-picture) (PNG/JPG/GIF/SVG, fill modes: stretch/contain/cover/tile, brightness/contrast/glow/shadow, rotation, link + tooltip), [tables](https://github.com/iOfficeAI/OfficeCLI/wiki/ppt-table) (built-in PowerPoint style catalogue, virtual `/col[C]`\n\nget + swap/copyFrom, row/col Move/CopyFrom, fill/background alias), [charts](https://github.com/iOfficeAI/OfficeCLI/wiki/ppt-chart) (pieOfPie, barOfPie, per-attr axisLine/gridline setters, series add/remove with theme palette, `anchor=x,y,w,h`\n\nshorthand), [animations](https://github.com/iOfficeAI/OfficeCLI/wiki/ppt-shape-set) (15 emphasis + 16 exit template-backed presets, multi-effect chains, motion-path presets, repeat/restart/autoReverse, chart animations + `chartBuild`\n\n), [transitions](https://github.com/iOfficeAI/OfficeCLI/wiki/ppt-morph-check) (morph + p14 + 12 p15 PowerPoint 2013+ presets), [3D models (.glb)](https://github.com/iOfficeAI/OfficeCLI/wiki/ppt-3dmodel) (combined `rotation=ax,ay,az`\n\n), [slide zoom](https://github.com/iOfficeAI/OfficeCLI/wiki/ppt-zoom), [equations](https://github.com/iOfficeAI/OfficeCLI/wiki/ppt-equation) (LaTeX input), [diagrams](https://github.com/iOfficeAI/OfficeCLI/wiki/diagram) (mermaid flowchart / sequence → native editable shapes, or any mermaid type as a full-fidelity PNG), [themes](https://github.com/iOfficeAI/OfficeCLI/wiki/ppt-theme), [connectors](https://github.com/iOfficeAI/OfficeCLI/wiki/ppt-connector) (`from`\n\n/`to`\n\naccept a full `/slide[N]/shape[@name=Foo]`\n\npath), [video/audio](https://github.com/iOfficeAI/OfficeCLI/wiki/ppt-video) (loop, autoStart), [groups](https://github.com/iOfficeAI/OfficeCLI/wiki/ppt-group) (link + tooltip; Get/Query/Add/Remove all descend into groups), [notes](https://github.com/iOfficeAI/OfficeCLI/wiki/ppt-notes) (RTL, lang), [comments](https://github.com/iOfficeAI/OfficeCLI/wiki/ppt-comment) (RTL, legacy + modern p188 threaded round-trip), SmartArt (round-trip via add-part + raw-set), [OLE objects](https://github.com/iOfficeAI/OfficeCLI/wiki/ppt-ole), [placeholders](https://github.com/iOfficeAI/OfficeCLI/wiki/ppt-placeholder) (add/set by phType)\n\n**For Developers:**\n\n- Automate report generation from databases or APIs\n- Batch-process documents (bulk find/replace, style updates)\n- Build document pipelines in CI/CD environments (generate docs from test results)\n- Headless Office automation in Docker/containerized environments\n\n**For AI Agents:**\n\n- Generate presentations from user prompts (see examples above)\n- Extract structured data from documents to JSON\n- Validate and check document quality before delivery\n\n**For Teams:**\n\n- Clone document templates and populate with data\n- Automated document validation in CI/CD pipelines\n\nShips as a single self-contained binary. The .NET runtime is embedded -- nothing to install, no runtime to manage.\n\n**One-line install:**\n\n```\n# macOS / Linux\ncurl -fsSL https://raw.githubusercontent.com/iOfficeAI/OfficeCLI/main/install.sh | bash\n\n# Windows (PowerShell)\nirm https://raw.githubusercontent.com/iOfficeAI/OfficeCLI/main/install.ps1 | iex\n```\n\n**Or download manually** from [GitHub Releases](https://github.com/iOfficeAI/OfficeCLI/releases):\n\n| Platform | Binary |\n|---|---|\n| macOS Apple Silicon | `officecli-mac-arm64` |\n| macOS Intel | `officecli-mac-x64` |\n| Linux x64 | `officecli-linux-x64` |\n| Linux ARM64 | `officecli-linux-arm64` |\n| Windows x64 | `officecli-win-x64.exe` |\n| Windows ARM64 | `officecli-win-arm64.exe` |\n\nVerify installation: `officecli --version`\n\n**Or self-install from a downloaded binary (or run bare officecli to auto-install):**\n\n```\nofficecli install    # explicit\nofficecli            # bare invocation also triggers install\n```\n\nUpdates are checked automatically in the background. Disable with `officecli config autoUpdate false`\n\nor skip per-invocation with `OFFICECLI_SKIP_UPDATE=1`\n\n. Configuration lives under `~/.officecli/config.json`\n\n.\n\nOfficeCLI is self-contained. The capabilities below ship inside the binary — **no Office required**.\n\nOfficeCLI'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`\n\nmodels 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:\n\n— standalone HTML file, assets inlined. Open in any browser.`view html`\n\n— per-page PNG, ready for multimodal agents to read.`view screenshot`\n\n— local HTTP server with auto-refreshing preview; every`watch`\n\n`add`\n\n/`set`\n\n/`remove`\n\nupdates the browser instantly. Excel watch supports inline cell editing and drag-to-reposition charts.\n\n```\nofficecli view deck.pptx html -o /tmp/deck.html\nofficecli view deck.pptx screenshot -o /tmp/deck.png # add --page 1-N for more slides\nofficecli watch deck.pptx                            # http://localhost:26315\n```\n\nWithout 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\n\nrender → look → fixloop works in CI, in Docker, on a server with no display — anywhere the binary runs.\n\n350+ built-in Excel functions evaluated automatically on write — write `=SUM(A1:A2)`\n\n, `get`\n\nthe cell, the value is already there. No round-trip through Office to recalc. Covers spilling dynamic arrays (`FILTER`\n\n/ `SORT`\n\n/ `UNIQUE`\n\n/ `SEQUENCE`\n\n/ `LET`\n\n/ `LAMBDA`\n\n/ `MAP`\n\n), `VLOOKUP`\n\n/ `XLOOKUP`\n\n/ `INDEX`\n\n/ `MATCH`\n\n, financial & bond math (`XIRR`\n\n/ `PRICE`\n\n/ `YIELD`\n\n/ `DURATION`\n\n/ `COUPNUM`\n\n), statistical distributions, tests & regression (`NORM.DIST`\n\n/ `T.TEST`\n\n/ `LINEST`\n\n), and date & text functions.\n\nPlus native OOXML pivot tables from a source range with one command — multi-field rows/cols/filters, 10 aggregations, `showDataAs`\n\nmodes, date grouping, calculated fields, top-N, layouts. Pivot cache + definition are written to OOXML, so Excel opens the file with the aggregation already populated:\n\n```\nofficecli add sales.xlsx '/Sheet1' --type pivottable \\\n  --prop source='Data!A1:E10000' --prop rows='Region,Category' \\\n  --prop cols=Quarter --prop values='Revenue:sum,Units:avg' \\\n  --prop showDataAs=percentOfTotal\n```\n\n`merge`\n\nreplaces `{{key}}`\n\nplaceholders in any `.docx`\n\n/ `.xlsx`\n\n/ `.pptx`\n\nwith 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.\n\n```\nofficecli merge invoice-template.docx out-001.docx '{\"client\":\"Acme\",\"total\":\"$5,200\"}'\nofficecli merge q4-template.pptx q4-acme.pptx data.json\n```\n\n`dump`\n\nserializes any `.docx`\n\n, `.pptx`\n\n, or `.xlsx`\n\n— whole document **or any subtree** (a single paragraph, table, slide, worksheet, the styles part, numbering, theme, or settings) — into a replayable batch JSON; `batch`\n\nreplays 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.\"\n\n```\nofficecli dump existing.docx -o blueprint.json                  # whole document\nofficecli dump existing.docx /body/tbl[1] -o table.json         # any subtree\nofficecli dump existing.xlsx /Sheet1 -o sheet.json              # a single worksheet\nofficecli batch new.docx --input blueprint.json\n```\n\nFor multi-step workflows, resident mode keeps the document in memory. Batch mode applies multiple operations in a single pass.\n\n```\n# Resident mode — near-zero latency via named pipes\nofficecli open report.docx\nofficecli set report.docx /body/p[1]/r[1] --prop bold=true\nofficecli set report.docx /body/p[2]/r[1] --prop color=FF0000\nofficecli close report.docx\n\n# Batch mode — multi-command execution (continues on error by default; --stop-on-error to abort)\necho '[{\"command\":\"set\",\"path\":\"/slide[1]/shape[1]\",\"props\":{\"text\":\"Hello\"}},\n      {\"command\":\"set\",\"path\":\"/slide[1]/shape[2]\",\"props\":{\"fill\":\"FF0000\"}}]' \\\n  | officecli batch deck.pptx --json\n\n# Inline batch with --commands (no stdin needed)\nofficecli batch deck.pptx --commands '[{\"op\":\"set\",\"path\":\"/slide[1]/shape[1]\",\"props\":{\"text\":\"Hi\"}}]'\n\n# Abort on the first failing command (default is continue-on-error)\nofficecli batch deck.pptx --input updates.json --stop-on-error --json\n```\n\nReading the file with another tool? Flush to disk first.officecli's own reads (`get`\n\n/`query`\n\n/`view`\n\n) 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:\n\n```\nofficecli set report.docx /body/p[1] --prop bold=true\nofficecli save report.docx           # flush, keep the resident warm (or `close` to flush + release)\npython my_reader.py report.docx      # now sees the edit\n```\n\nA 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\n\n`OFFICECLI_RESIDENT_FLUSH=each`\n\n— every mutation is on disk before the command returns, while the resident stays warm. Full flush model (`each`\n\n/`auto`\n\n/fixed/`off`\n\n, save / close, env tuning):[wiki → open / close].\n\nStart simple, go deep only when needed.\n\n| Layer | Purpose | Commands |\n|---|---|---|\nL1: Read |\nSemantic views of content | `view` (text, annotated, outline, stats, issues, html, svg, screenshot) |\nL2: DOM |\nStructured element operations | `get` , `query` , `set` , `add` , `remove` , `move` , `swap` |\nL3: Raw XML |\nDirect XPath access — universal fallback | `raw` , `raw-set` , `add-part` , `validate` |\n\n```\n# L1 — high-level views\nofficecli view report.docx annotated\nofficecli view budget.xlsx text --cols A,B,C --max-lines 50\n\n# L2 — element-level operations\nofficecli query report.docx \"run:contains(TODO)\"\nofficecli add budget.xlsx / --type sheet --prop name=\"Q2 Report\"\nofficecli move report.docx /body/p[5] --to /body --index 1\n\n# L3 — raw XML when L2 isn't enough\nofficecli raw deck.pptx '/slide[1]'\nofficecli raw-set report.docx document \\\n  --xpath \"//w:p[1]\" --action append \\\n  --xml '<w:r><w:t>Injected text</w:t></w:r>'\n```\n\nBuilt-in [MCP](https://modelcontextprotocol.io) server — register with one command:\n\n```\nofficecli mcp claude       # Claude Code\nofficecli mcp cursor       # Cursor\nofficecli mcp vscode       # VS Code / Copilot\nofficecli mcp lmstudio     # LM Studio\nofficecli mcp list         # Check registration status\n```\n\nExposes all document operations as tools over JSON-RPC — no shell access needed.\n\nGet OfficeCLI working with your AI agent in two steps:\n\n**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.\n\n**Manual setup (optional)**\n\nIf auto-install doesn't cover your setup, you can install the skill file manually:\n\n**Feed SKILL.md to your agent directly:**\n\n```\ncurl -fsSL https://officecli.ai/SKILL.md\n```\n\n**Install as a local skill for Claude Code:**\n\n```\ncurl -fsSL https://officecli.ai/SKILL.md -o ~/.claude/skills/officecli.md\n```\n\n**Other agents:** Include the contents of `SKILL.md`\n\nin your agent's system prompt or tool description.\n\n**Deterministic JSON output**— every command supports`--json`\n\nwith consistent schemas. No regex parsing, no scraping stdout.**Path-based addressing**— every element has a stable path (`/slide[1]/shape[2]`\n\n). 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`\n\n,`view issues`\n\n, and the structured error codes (`not_found`\n\n,`invalid_value`\n\n,`unsupported_property`\n\n) return suggestions and valid ranges. Agents self-correct without human intervention.**Built-in agent-friendly rendering engine**—`view html`\n\n/`view screenshot`\n\n/`watch`\n\nemit 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}}`\n\nplaceholders N times. Avoids burning tokens regenerating every report from scratch.**Round-trip dump**—`dump`\n\nturns any`.docx`\n\n,`.pptx`\n\n, or`.xlsx`\n\ninto 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>`\n\ninstead of guessing.**Auto-install**— OfficeCLI detects your AI tooling (Claude Code, Cursor, VS Code, …) and configures itself. No manual skill-file setup.\n\nDon't guess property names — drill into the help:\n\n```\nofficecli pptx set              # All settable elements and properties\nofficecli pptx set shape        # Detail for one element type\nofficecli pptx set shape.fill   # One property: format and examples\nofficecli docx query            # Selector reference: attributes, :contains, :has(), etc.\n```\n\nRun `officecli --help`\n\nfor the full overview.\n\nAll commands support `--json`\n\n. The general response shapes:\n\n**Single element** (`get --json`\n\n):\n\n```\n{\"tag\": \"shape\", \"path\": \"/slide[1]/shape[1]\", \"attributes\": {\"name\": \"TextBox 1\", \"text\": \"Hello\"}}\n```\n\n**List of elements** (`query --json`\n\n):\n\n```\n[\n  {\"tag\": \"paragraph\", \"path\": \"/body/p[1]\", \"attributes\": {\"style\": \"Heading1\", \"text\": \"Title\"}},\n  {\"tag\": \"paragraph\", \"path\": \"/body/p[5]\", \"attributes\": {\"style\": \"Heading1\", \"text\": \"Summary\"}}\n]\n```\n\n**Errors** return a non-zero exit code with a structured error object including error code, suggestion, and valid values when available:\n\n```\n{\n  \"success\": false,\n  \"error\": {\n    \"error\": \"Slide 50 not found (total: 8)\",\n    \"code\": \"not_found\",\n    \"suggestion\": \"Valid Slide index range: 1-8\"\n  }\n}\n```\n\nError codes: `not_found`\n\n, `invalid_value`\n\n, `unsupported_property`\n\n, `invalid_path`\n\n, `unsupported_type`\n\n, `missing_property`\n\n, `file_not_found`\n\n, `file_locked`\n\n, `invalid_selector`\n\n. Property names are auto-corrected -- misspelling a property returns a suggestion with the closest match.\n\n**Error Recovery** -- Agents self-correct by inspecting available elements:\n\n```\n# Agent tries an invalid path\nofficecli get report.docx /body/p[99] --json\n# Returns: {\"success\": false, \"error\": {\"error\": \"...\", \"code\": \"not_found\", \"suggestion\": \"...\"}}\n\n# Agent self-corrects by checking available elements\nofficecli get report.docx /body --depth 1 --json\n# Returns the list of available children, agent picks the right path\n```\n\n**Mutation confirmations** (`set`\n\n, `add`\n\n, `remove`\n\n, `move`\n\n, `create`\n\nwith `--json`\n\n):\n\n```\n{\"success\": true, \"path\": \"/slide[1]/shape[1]\"}\n```\n\nSee `officecli --help`\n\nfor full details on exit codes and error formats.\n\n| OfficeCLI | Microsoft Office | LibreOffice | python-docx / openpyxl | |\n|---|---|---|---|---|\n| Open source & free | ✓ (Apache 2.0) | ✗ (paid license) | ✓ | ✓ |\n| AI-native CLI + JSON | ✓ | ✗ | ✗ | ✗ |\n| Zero install (single binary) | ✓ | ✗ | ✗ | ✗ (Python + pip) |\n| Call from any language | ✓ (CLI) | ✗ (COM/Add-in) | ✗ (UNO API) | Python only |\n| Path-based element access | ✓ | ✗ | ✗ | ✗ |\n| Raw XML fallback | ✓ | ✗ | ✗ | Partial |\n| Built-in agent-friendly rendering engine | ✓ | ✗ | ✗ | ✗ |\n| Headless HTML/PNG output | ✓ | ✗ | Partial | ✗ |\nTemplate merge (`{{key}}` ) across formats |\n✓ | ✗ | ✗ | ✗ |\n| Round-trip dump → batch JSON | ✓ | ✗ | ✗ | ✗ |\n| Live preview (auto-refresh on edit) | ✓ | ✗ | ✗ | ✗ |\n| Headless / CI | ✓ | ✗ | Partial | ✓ |\n| Cross-platform | ✓ | Windows/Mac | ✓ | ✓ |\n| Word + Excel + PowerPoint | ✓ | ✓ | ✓ | Separate libs |\n\n| Command | Description |\n|---|---|\n`create` |\n\n`view`\n\n`outline`\n\n, `text`\n\n, `annotated`\n\n, `stats`\n\n(`--page-count`\n\n), `issues`\n\n, `html`\n\n, `svg`\n\n, `screenshot`\n\n, `pdf`\n\n(via exporter plugin), `forms`\n\n(via format-handler plugin)). docx supports `--render auto|native|html`\n\n.`load_skill`\n\n`get`\n\n`--depth N`\n\n, `--json`\n\n)`query`\n\n`and`\n\n/`or`\n\n, row-by-column-name (`row[Salary>5000]`\n\n), `--find`\n\nflag`set`\n\n`get`\n\n/`query`\n\n), `--find`\n\n/`--replace`\n\nflags`add`\n\n`--from <path>`\n\n)`remove`\n\n`move`\n\n`--to <parent>`\n\n, `--index N`\n\n, `--after <path>`\n\n, `--before <path>`\n\n)`swap`\n\n`validate`\n\n`view <file> issues`\n\n`batch`\n\n`--input`\n\n, or `--commands`\n\n; continues on error by default, `--stop-on-error`\n\nto abort)`dump`\n\n`.docx`\n\n, `.pptx`\n\n, or `.xlsx`\n\ninto a replayable batch JSON (round-trip via `batch`\n\n); accepts a subtree path`refresh`\n\n`PAGE`\n\n/ cross-references (`.docx`\n\n; Word backend on Windows, headless-HTML fallback)`plugins`\n\n`.doc`\n\n, `.hwpx`\n\n, `.pdf`\n\nexport via dump-reader / exporter / format-handler kinds)`merge`\n\n`{{key}}`\n\nplaceholders with JSON data`watch`\n\n`mcp`\n\n`raw`\n\n`raw-set`\n\n`add-part`\n\n`open`\n\n`close`\n\n`install`\n\n`all`\n\n, `claude`\n\n, `cursor`\n\n, etc.)`config`\n\n`<format> <command>`\n\n[Built-in help](https://github.com/iOfficeAI/OfficeCLI/wiki/command-reference)(e.g.`officecli pptx set shape`\n\n)A typical self-healing agent workflow: create a presentation, populate it, verify, and fix issues -- all without human intervention.\n\n```\n# 1. Create\nofficecli create report.pptx\n\n# 2. Add content\nofficecli add report.pptx / --type slide --prop title=\"Q4 Results\"\nofficecli add report.pptx '/slide[1]' --type shape \\\n  --prop text=\"Revenue: $4.2M\" --prop x=2cm --prop y=5cm --prop size=28\nofficecli add report.pptx / --type slide --prop title=\"Details\"\nofficecli add report.pptx '/slide[2]' --type shape \\\n  --prop text=\"Growth driven by new markets\" --prop x=2cm --prop y=5cm\n\n# 3. Verify\nofficecli view report.pptx outline\nofficecli validate report.pptx\n\n# 4. Fix any issues found\nofficecli view report.pptx issues --json\n# Address issues based on output, e.g.:\nofficecli set report.pptx '/slide[1]/shape[1]' --prop font=Arial\n```\n\nAll dimension and color properties accept flexible input formats:\n\n| Type | Accepted formats | Examples |\n|---|---|---|\nDimensions |\ncm, in, pt, px, or raw EMU | `2cm` , `1in` , `72pt` , `96px` , `914400` |\nColors |\nHex, named, RGB, theme | `#FF0000` , `FF0000` , `red` , `rgb(255,0,0)` , `accent1` |\nFont sizes |\nBare number or pt-suffixed | `14` , `14pt` , `10.5pt` |\nSpacing |\npt, cm, in, or multiplier | `12pt` , `0.5cm` , `1.5x` , `150%` |\n\n```\n# Replace all Heading1 text in a Word doc\nofficecli query report.docx \"paragraph[style=Heading1]\" --json | ...\nofficecli set report.docx /body/p[1]/r[1] --prop text=\"New Title\"\n\n# Export all slide content as JSON\nofficecli get deck.pptx / --depth 2 --json\n\n# Bulk-update Excel cells\nofficecli batch budget.xlsx --input updates.json --json\n\n# Import CSV data into an Excel sheet\nofficecli add budget.xlsx / --type sheet --prop name=\"Q1 Data\" --prop csv=sales.csv\n\n# Template merge for batch reports\nofficecli merge invoice-template.docx invoice-001.docx '{\"client\":\"Acme\",\"total\":\"$5,200\"}'\n\n# Check document quality before delivery\nofficecli validate report.docx && officecli view report.docx issues --json\n```\n\n**From Python or Node.js** — install one of the thin resident-pipe SDKs (no per-call process spawn):\n\n``` python\n# Python — `pip install officecli-sdk`\nfrom officecli import Doc\nwith Doc(\"deck.pptx\") as d:\n    d.add(\"/\", type=\"slide\", title=\"Q4 Report\")\n    print(d.get(\"/slide[1]\"))\njs\n// Node.js — `npm install @officecli/sdk`\nimport { Doc } from \"@officecli/sdk\";\nawait using d = await Doc.open(\"deck.pptx\");\nawait d.add(\"/\", { type: \"slide\", title: \"Q4 Report\" });\nconsole.log(await d.get(\"/slide[1]\"));\n```\n\nBoth SDKs auto-provision the native CLI when missing (mirror-first, Windows-capable) and announce the install rather than doing it silently.\n\nOr wrap subprocess directly, one-shot:\n\n``` python\nimport json, subprocess\ndef cli(*args):\n    return json.loads(subprocess.check_output([\"officecli\", *args, \"--json\"], text=True))\ncli(\"create\", \"deck.pptx\")\n```\n\nThe [Wiki](https://github.com/iOfficeAI/OfficeCLI/wiki) has detailed guides for every command, element type, and property:\n\n**By format:**[Word](https://github.com/iOfficeAI/OfficeCLI/wiki/word-reference)|[Excel](https://github.com/iOfficeAI/OfficeCLI/wiki/excel-reference)|[PowerPoint](https://github.com/iOfficeAI/OfficeCLI/wiki/powerpoint-reference)**Workflows:**[End-to-end examples](https://github.com/iOfficeAI/OfficeCLI/wiki/workflows)-- Word reports, Excel dashboards, PowerPoint decks, batch modifications, resident mode**Runnable examples:**[examples/](/iOfficeAI/OfficeCLI/blob/main/examples)-- copy-paste scripts (.sh/.py) for Word, Excel, and PowerPoint, with output files included**Troubleshooting:**[Common errors and solutions](https://github.com/iOfficeAI/OfficeCLI/wiki/troubleshooting)** AI agent guide:**[Decision tree for navigating the wiki](https://github.com/iOfficeAI/OfficeCLI/wiki/agent-guide)\n\nRequires [.NET 10 SDK](https://dotnet.microsoft.com/download) for compilation only. The output is a self-contained, native binary -- .NET is embedded in the binary and is not needed at runtime.\n\n```\n./build.sh\n```\n\nBug reports and contributions are welcome on [GitHub Issues](https://github.com/iOfficeAI/OfficeCLI/issues).\n\nIf you find OfficeCLI useful, please [give it a star on GitHub](https://github.com/iOfficeAI/OfficeCLI) — it helps others discover the project.", "url": "https://wpnews.pro/news/officecli-office-suite-for-ai-agents-to-read-and-edit-microsoft-office-files", "canonical_source": "https://github.com/iOfficeAI/OfficeCLI", "published_at": "2026-07-06 16:47:44+00:00", "updated_at": "2026-07-07 01:38:56.363306+00:00", "lang": "en", "topics": ["ai-tools", "developer-tools", "ai-agents", "generative-ai"], "entities": ["OfficeCLI", "Microsoft Office", "AionUi", "Claude Code", "Cursor", "Windsurf", "GitHub Copilot", "GitHub"], "alternates": {"html": "https://wpnews.pro/news/officecli-office-suite-for-ai-agents-to-read-and-edit-microsoft-office-files", "markdown": "https://wpnews.pro/news/officecli-office-suite-for-ai-agents-to-read-and-edit-microsoft-office-files.md", "text": "https://wpnews.pro/news/officecli-office-suite-for-ai-agents-to-read-and-edit-microsoft-office-files.txt", "jsonld": "https://wpnews.pro/news/officecli-office-suite-for-ai-agents-to-read-and-edit-microsoft-office-files.jsonld"}}