AI agents can read, edit, and verify Word, Excel, and PowerPoint files with a single binary
Imagine an AI agent visually inspecting document layouts and correcting errors on its own. OfficeCLI is an open-source tool designed to let AI agents read, modify, and automate Word, Excel, and PowerPoint files. It runs as a single binary without requiring a Microsoft Office installation, allowing AI-generated documents to be verified in real-time previews.
Built-in rendering engine as the AI's eyes
The biggest barrier for AI agents generating documents is the inability to visually verify the results. OfficeCLI addresses this by embedding a high-resolution HTML rendering engine directly inside the binary. This engine converts .docx, .xlsx, and .pptx files into HTML or PNG images, enabling the AI to determine if titles are overflowing or shapes are overlapping. As a result, the 'render → check → fix' loop operates without interruption, even in server or container environments. In headless environments without office software installed, the AI can verify its own output and resolve layout issues immediately.
Complex code reduced to one-line commands
Document manipulation that previously required combining multiple Python libraries and writing dozens of lines of code is handled by OfficeCLI with simple commands. For example, adding a slide to a PowerPoint presentation and inserting text is completed with a single officecli add command. All commands support consistent JSON output, allowing AI agents to easily parse the results. Additionally, stable paths are assigned to all elements within the document, enabling the AI to navigate and modify documents without understanding XML namespaces. When errors occur, structured error codes and fix suggestions are returned to help the AI resolve the problem on its own.
Template merging and real-time preview
A template merging feature is provided for repetitive report generation. Once an agent designs a layout, production code fills {{key}} placeholders with JSON data to generate numerous documents consistently. This reduces layout inconsistencies and token consumption that occur when generating documents from scratch every time. Running the watch command provides a real-time preview in a local browser, where any command added or modified in the document is reflected immediately on the browser screen. For Excel, real-time support for cell editing and chart position adjustment allows users to verify results instantly.
Installation and AI agent integration
OfficeCLI is distributed as a single binary with an embedded .NET runtime, so it can be used immediately without installing additional dependencies. It supports macOS, Linux, and Windows, and can be installed via brew, scoop, npm, or an installation script. After installation, running the officecli install command automatically detects major AI coding agents such as Claude Code, Cursor, and GitHub Copilot, and installs skill files. Once this process is complete, the agent gains the ability to create, read, and modify Office documents immediately without additional configuration. An MCP server is also built-in, exposing document manipulation tools via JSON-RPC.
Pre-use considerations
OfficeCLI is an open-source project released under the Apache 2.0 license. It supports reading, modifying, and creating files in all three formats: Word, Excel, and PowerPoint, and is specifically optimized for integration with AI agents. It follows the OOXML standard for compatibility with existing office files, but some complex features may need to be handled through raw XML access (L3 layer). It is recommended to ensure that OfficeCLI's resident mode has fully saved data to disk before other programs read the file. You can explicitly flush using the save or close commands, or adjust the automatic flush interval by setting environment variables.