tmustier/pi-for-excel

Experimental Excel sidebar agent add-in. Multi-model. Powered by Pi.

Pi for Excel – AI‑powered spreadsheet assistant

What it is – An open‑source Office add‑in that puts a conversational AI agent directly inside Microsoft Excel. The agent can read, write, format, and analyse the workbook using any LLM you configure (Anthropic, OpenAI, Google Gemini, GitHub Copilot, or a custom OpenAI‑compatible endpoint).

Key capabilities

  • 16 built‑in spreadsheet tools – e.g. read_range, write_cells, fill_formula, search_workbook, explain_formula, conditional_format, and a tool for tracing formula dependencies.
  • Multi‑model support – switch providers or models on the fly via slash commands (/model).
  • Session handling – multiple chat tabs per workbook, auto‑save, history, and a /resume command.
  • Auto‑context injection – the AI automatically receives a blueprint of the workbook, the current selection, and recent changes, so you don’t have to describe the sheet.
  • One‑click rollback – every mutating operation creates a checkpoint; the sidebar can revert a change instantly.
  • Formatting conventions – define house‑style rules (currency symbol, negative style, decimal places) once and the agent follows them.
  • Slash commands & extensions/settings, /tools, /extensions, etc., plus the ability to install sandboxed extensions (mini‑apps) generated by the AI.
  • External integrations – optional web‑search (Jina, Serper, Tavily, Brave) and an MCP gateway for custom tools.

How to get it

  1. Download manifest.prod.xml from the repo (or the Vercel‑hosted URL).
  2. Add the manifest to Excel (macOS, Windows, or Excel on the web – see the linked install guide).
  3. Open the Pi pane from the ribbon, connect a provider with an API key or OAuth, and start chatting (e.g., “What sheets do I have?”).

Developer quick‑start

  • Requires Node ≥ 22.19 (or ≥ 24) and mkcert for local HTTPS.
  • Clone, run npm install, generate a local cert, then npm run dev (Vite serves the add‑in at https://localhost:3141).
  • Follow the repo’s sideload instructions to load the dev manifest into Excel.
  • Optional helpers: npx pi-for-excel-proxy (CORS proxy for OAuth), npx pi-for-excel-python-bridge, and npx pi-for-excel-tmux-bridge for local Python/LibreOffice or tmux bridges.

Architecture at a glance

  • Frontend – Vite‑bundled single‑page task‑pane built with Lit web components.
  • Agent core@earendil-works/pi-agent-core runs the tool‑loop, streaming, and state management.
  • LLM abstraction@earendil-works/pi-ai provides a uniform API for Anthropic, OpenAI, Gemini, Copilot, or custom endpoints.
  • Office.js – used to read/write the workbook and to manage UI integration.
  • Tool registry – central definition of all 16 core tools; UI, prompts, and runtime all derive from this registry.
  • Extension sandbox – untrusted extensions execute in an iframe with permission enforcement.
  • Storage – IndexedDB holds session data, checkpoints, and user‑level rules.

Why it matters Pi for Excel demonstrates how a full‑featured LLM‑driven agent can be embedded in a legacy productivity app, turning a static spreadsheet into an interactive, AI‑augmented workspace. It showcases practical patterns—tool registries, auto‑context injection, checkpoint‑based rollback, and sandboxed extensions—that are reusable for other Office add‑ins or desktop‑app AI integrations.

License – MIT (© Thomas Mustier).

Related

  • Project
  • Project
  • Project
  • Project
  • Project