- name
- officecli-office-automation
- description
- Use OfficeCLI to create, read, and edit Word, Excel, and PowerPoint files from the command line with AI-friendly commands.
- triggers
- ["create a Word document","edit an Excel spreadsheet","make a PowerPoint presentation","modify Office files","automate document generation","convert Office files to HTML","add slides to presentation","update spreadsheet formulas"]
# OfficeCLI Office Automation Skill
> Skill by [ara.so](https://ara.so) — Devtools Skills collection.
OfficeCLI is an Office suite purpose-built for AI agents to create, read, and edit Word (.docx), Excel (.xlsx), and PowerPoint (.pptx) files. It's a single binary with no Office installation required, featuring a unified CLI interface and built-in rendering to HTML/PNG.
## Installation
**macOS / Linux:**
```bash
curl -fsSL https://raw.githubusercontent.com/iOfficeAI/OfficeCLI/main/install.sh | bash
```
**Windows (PowerShell):**
```powershell
irm https://raw.githubusercontent.com/iOfficeAI/OfficeCLI/main/install.ps1 | iex
```
**Manual installation:**
1. Download the binary for your platform from [GitHub Releases](https://github.com/iOfficeAI/OfficeCLI/releases)
2. Run `officecli install` to add to PATH
**Verify installation:**
```bash
officecli --version
```
## Core Commands
### File Operations
**Create a new document:**
```bash
# Blank files
officecli create document.docx
officecli create spreadsheet.xlsx
officecli create presentation.pptx
# With initial content
officecli create report.docx --prop title="Q4 Report"
```
**View document content:**
```bash
# View as outline (tree structure)
officecli view document.docx outline
# View as plain text
officecli view document.docx text
# View as HTML (opens in browser)
officecli view document.docx html
# View as JSON structure
officecli view document.docx json
```
**Get specific elements:**
```bash
# Get element details as JSON
officecli get document.docx '/paragraph[1]' --json
officecli get spreadsheet.xlsx '$Sheet1:A1' --json
officecli get presentation.pptx '/slide[1]/shape[2]' --json
```
### Live Preview
**Watch mode (auto-refresh in browser):**
```bash
# Start live preview server on http://localhost:26315
officecli watch presentation.pptx
# Custom port
officecli watch presentation.pptx --port 8080
# Every edit you make will auto-refresh the browser
```
## Word Documents (.docx)
### Path Syntax
- `/paragraph[N]` - Nth paragraph (1-indexed)
- `/paragraph[N]/run[M]` - Mth run in Nth paragraph
- `/table[N]` - Nth table
- `/table[N]/row[R]/cell[C]` - Cell in table
### Add Content
**Add paragraphs:**
```bash
# Simple paragraph
officecli add report.docx / --type paragraph --prop text="Executive Summary"
# Styled paragraph
officecli add report.docx / --type paragraph \
--prop text="Quarterly Revenue Analysis" \
--prop style=Heading1 \
--prop align=center
# With formatting
officecli add report.docx / --type paragraph \
--prop text="Important notice" \
--prop bold=true \
--prop color=FF0000 \
--prop size=14
```
**Add runs (inline formatting):**
```bash
officecli add report.docx '/paragraph[1]' --type run \
--prop text="bold text" \
--prop bold=true
```
**Add tables:**
```bash
# 3x3 table
officecli add report.docx / --type table \
--prop rows=3 \
--prop cols=3
# Set cell content
officecli set report.docx '/table[1]/row[1]/cell[1]' \
--prop text="Header 1"
```
**Add images:**
```bash
officecli add report.docx / --type picture \
--prop src=chart.png \
--prop width=15cm \
--prop height=10cm
```
**Add headers/footers:**
```bash
# Add header to first section
officecli add report.docx '/section[1]' --type header \
--prop type=default
# Add content to header
officecli add report.docx '/section[1]/header[1]' --type paragraph \
--prop text="Confidential Report" \
--prop align=right
```
### Modify Content
**Set paragraph properties:**
```bash
officecli set report.docx '/paragraph[1]' \
--prop text="Updated title" \
--prop style=Heading1 \
--prop align=center \
--prop spaceBefore=240 \
--prop spaceAfter=120
```
**Set run properties:**
```bash
officecli set report.docx '/paragraph[2]/run[1]' \
--prop bold=true \
--prop italic=true \
--prop font=Arial \
--prop size=12 \
--prop color=0000FF
```
### Remove Content
```bash
# Remove paragraph
officecli remove report.docx '/paragraph[3]'
# Remove table
officecli remove report.docx '/table[1]'
```
### RTL and i18n Support
```bash
# RTL paragraph (Arabic, Hebrew)
officecli add report.docx / --type paragraph \
--prop text="مرحبا بك" \
--prop direction=rtl \
--prop lang.cs=ar-SA
# Per-script fonts
officecli add report.docx / --type paragraph \
--prop text="Hello 世界 مرحبا" \
--prop font.latin=Arial \
--prop font.ea="MS Gothic" \
--prop font.cs="Arial Unicode MS"
```
## Excel Spreadsheets (.xlsx)
### Cell Addressing
- `$SheetName:A1` - Cell A1 in named sheet
- `$Sheet1:B2:D4` - Range B2:D4
- `/sheet[1]/cell[A1]` - Path-based addressing
### Add Content
**Add sheets:**
```bash
# Add new sheet
officecli add budget.xlsx / --type sheet --prop name="Q1 Budget"
# Add with properties
officecli add budget.xlsx / --type sheet \
--prop name="Summary" \
--prop tabColor=FF0000 \
--prop state=visible
```
**Add cells:**
```bash
# Simple value
officecli add budget.xlsx '$Sheet1:A1' --type cell \
--prop value="Revenue"
# Number with formatting
officecli add budget.xlsx '$Sheet1:B1' --type cell \
--prop value=125000 \
--prop format='$#,##0.00'
# Formula
officecli add budget.xlsx '$Sheet1:C1' --type cell \
--prop formula='=SUM(B1:B10)'
# Date
officecli add budget.xlsx '$Sheet1:D1' --type cell \
--prop value=2024-01-15 \
--prop format='yyyy-mm-dd'
```
**Batch add cells:**
```bash
# Multiple cells
officecli add budget.xlsx '$Sheet1:A1' --type cell --prop value="Name"
officecli add budget.xlsx '$Sheet1:B1' --type cell --prop value="Amount"
officecli add budget.xlsx '$Sheet1:A2' --type cell --prop value="Sales"
officecli add budget.xlsx '$Sheet1:B2' --type cell --prop value=50000
```
**Add tables:**
```bash
# Create table from range
officecli add budget.xlsx '$Sheet1:A1:C10' --type table \
--prop name="SalesData" \
--prop style=TableStyleMedium2 \
--prop showHeader=true
```
**Add charts:**
```bash
# Column chart
officecli add budget.xlsx '$Sheet1' --type chart \
--prop chartType=column \
--prop dataRange='$Sheet1:A1:B10' \
--prop title="Sales by Region" \
--prop x=5cm \
--prop y=2cm
# Pie chart
officecli add budget.xlsx '$Sheet1' --type chart \
--prop chartType=pie \
--prop dataRange='$Sheet1:A1:B5' \
--prop title="Market Share"
```
**Add pivot tables:**
```bash
officecli add budget.xlsx '$Sheet2:A1' --type pivottable \
--prop sourceRange='$Sheet1:A1:D100' \
--prop rowFields=Region \
--prop dataFields=Sales \
--prop name="SalesByRegion"
```
### Modify Content
**Set cell values:**
```bash
officecli set budget.xlsx '$Sheet1:A1' --prop value="Updated"
# With formatting
officecli set budget.xlsx '$Sheet1:B2' \
--prop value=75000 \
--prop format='$#,##0.00' \
--prop bold=true \
--prop color=FF0000
```
**Set sheet properties:**
```bash
officecli set budget.xlsx '/sheet[1]' \
--prop name="Renamed Sheet" \
--prop tabColor=00FF00 \
--prop direction=rtl
```
### Formulas
**150+ built-in functions with auto-evaluation:**
```bash
# Math
officecli add budget.xlsx '$Sheet1:C1' --type cell \
--prop formula='=SUM(A1:A10)'
# Conditional
officecli add budget.xlsx '$Sheet1:D1' --type cell \
--prop formula='=IF(B1>1000,"High","Low")'
# Lookup
officecli add budget.xlsx '$Sheet1:E1' --type cell \
--prop formula='=VLOOKUP(A1,$Sheet2:A:B,2,FALSE)'
# Date functions
officecli add budget.xlsx '$Sheet1:F1' --type cell \
--prop formula='=TODAY()'
```
### Sort Data
```bash
# Sort range by column
officecli add budget.xlsx '$Sheet1:A1:C10' --type sort \
--prop key1=B \
--prop order1=desc
# Multi-key sort
officecli add budget.xlsx '$Sheet1:A1:D20' --type sort \
--prop key1=A \
--prop order1=asc \
--prop key2=B \
--prop order2=desc
```
### Conditional Formatting
```bash
officecli add budget.xlsx '$Sheet1:B2:B10' --type conditionalformatting \
--prop type=colorScale \
--prop minColor=FF0000 \
--prop maxColor=00FF00
```
## PowerPoint Presentations (.pptx)
### Path Syntax
- `/slide[N]` - Nth slide
- `/slide[N]/shape[M]` - Mth shape on slide
- `/slide[N]/table[M]` - Mth table on slide
### Add Content
**Add slides:**
```bash
# Blank slide
officecli add deck.pptx / --type slide
# With title
officecli add deck.pptx / --type slide \
--prop title="Introduction"
# With background
officecli add deck.pptx / --type slide \
--prop title="Dark Theme" \
--prop background=1A1A2E
```
**Add shapes (text boxes):**
```bash
# Simple text box
officecli add deck.pptx '/slide[1]' --type shape \
--prop text="Hello World" \
--prop x=2cm \
--prop y=3cm \
--prop width=10cm \
--prop height=2cm
# Styled text box
officecli add deck.pptx '/slide[1]' --type shape \
--prop text="Key Findings" \
--prop x=1cm \
--prop y=2cm \
--prop font=Arial \
--prop size=32 \
--prop color=FFFFFF \
--prop bold=true \
--prop align=center
```
**Add images:**
```bash
# Basic image
officecli add deck.pptx '/slide[1]' --type picture \
--prop src=logo.png \
--prop x=1cm \
--prop y=1cm \
--prop width=5cm \
--prop height=3cm
# With effects
officecli add deck.pptx '/slide[1]' --type picture \
--prop src=photo.jpg \
--prop x=5cm \
--prop y=5cm \
--prop brightness=20 \
--prop contrast=10 \
--prop shadow=true
```
**Add tables:**
```bash
# Create table
officecli add deck.pptx '/slide[1]' --type table \
--prop rows=3 \
--prop cols=3 \
--prop x=2cm \
--prop y=5cm
# Set cell content
Ver no GitHub