An AI agent that lives inside Excel. Select cells, describe what you want in plain English, and watch OpenCode write and run Python to transform your data — with automatic self-correction on errors. No copy-paste, no context-switching, no debugging by hand.
How it's different: Not a chat sidebar that suggests formulas. A full agentic loop — the AI writes code, runs it, reads the output, fixes bugs, and retries — all inside a local sandbox. You only see the final result in your sheet.
| Dates normalized | Outliers flagged | Summary stats |
|---|---|---|
| "normalize these dates to MM/DD/YYYY" | "highlight outliers in red" | "mean, median, std in F1:G10" |
┌─────────────────┐ HTTP + WS ┌────────────────┐ subprocess ┌──────────┐
│ Excel Add-in │ ◄────────────────► │ Bridge Server │ ◄───────────────► │ OpenCode │
│ (React + O.js) │ localhost:7474 │ (Node.js) │ temp dir │ (Python) │
└────────┬────────┘ └────────────────┘ └──────────┘
│ Office.js │
▼ ▼
┌──────────┐ ┌──────────────┐
│ Excel │ │ sandbox/venv│
│ sheet │ │ pandas,numpy│
└──────────┘ └──────────────┘
Everything runs locally. Only the instruction + selected range go to your LLM provider.
- Node.js >= 18
- Python >= 3.9
- OpenCode CLI installed and configured with an API provider
- Excel (web or desktop) with sideloading enabled
git clone https://github.com/MohammadAlMasalmeh/opencode-excel.git
cd opencode-excel
npm install && npm run setup # installs JS deps + creates Python venv# Terminal 1 — Bridge server
npm run bridge
# Terminal 2 — Add-in dev server (with HTTPS)
npm run addin:devExcel on the web: Insert → Add-ins → Upload My Add-in → select addin/manifest.xml
Excel desktop (macOS):
# One-time cert trust:
sudo mkcert -install
open https://localhost:3000/taskpane/index.html # accept cert warning
# Sideload:
bash scripts/sideload-desktop.shThen click OpenCode in the Home ribbon.
- Select a data range in Excel
- Type what you want in the task pane (e.g. "flag outliers in column C and highlight them red")
- Click Run
- Watch the agent write Python, run it, fix any errors, and write results back to your sheet
- Set values — add new columns, transform existing data
- Format cells — fill colors, bold, font size
- Number formats — currency, dates, percentages
- Summary cells — write computed results to specific cells
- Charts and graphs — create native Excel column, bar, line, pie, scatter, area, and doughnut charts
opencode-excel/
├── addin/ # Office Add-in (React + TypeScript + Office.js)
│ ├── src/taskpane/ # Main UI components
│ ├── src/lib/ # Office.js wrappers, bridge client, ops
│ └── src/commands/ # Ribbon button handlers
├── bridge/ # Local bridge server (Express + WebSocket)
│ └── src/ # Session management, OpenCode spawner, validation
├── sandbox/ # Python environment (pandas, numpy, openpyxl, scipy)
│ ├── requirements.txt
│ └── setup.sh
└── scripts/ # Desktop sideload helper
| Layer | Tech |
|---|---|
| Add-in UI | TypeScript, React, Office.js |
| Add-in build | Vite |
| Bridge server | Node.js, Express, ws |
| Agent | OpenCode CLI |
| Execution | Python 3 (pandas, numpy, openpyxl, scipy) |
- Bridge writes
input.csv+ system prompt to a temp dir - OpenCode generates
script.py, runs it, reads output - If the script errors, OpenCode reads stderr, patches the bug, retries
- On success, writes
output.jsonwith structured operations - Bridge validates the output and streams back to the add-in
- Add-in applies operations to the sheet
MIT