SuperAPI AI Directory

spreadsheet-mcp

Token-efficient spreadsheet analysis and editing (xlsx/xlsm) with region detection, structured reads, formula and style inspection, forking and recalculation.

Open website

About this tool

spreadsheet-mcp (repository name agent-spreadsheet) is a spreadsheet interaction service for agents, designed to let agents read, analyze, modify, verify, and manipulate Excel workbooks in a safe, inspectable, token-efficient way without relying on fragile UI automation.

Purpose

This project provides a unified spreadsheet interaction layer for LLM agents, covering three surfaces: the WASM build (agent-spreadsheet-wasm) as the SDK's local runtime, plus native sessions and just-bash sessions. In version 0.16, these surfaces share a resident Rust document/evaluator runtime and a 32-operation registry. Explicit native sessions automatically start a private, log-based host; SDK/WASM and true just-bash sessions keep history in memory; XLSX export saves document snapshots rather than restartable session logs. The hot edit/recalculate/read loop avoids XLSX serialization and repeated evaluator ingestion.

Main capabilities

  • Supported workbook modes: .xlsx / .xlsm are readable and writable; .xls / .xlsb only support discovery/read-oriented workflows.
  • Powered by Formualizer: default in-process computation uses Formualizer, a permissively licensed (MIT/Apache-2.0) Rust spreadsheet engine that provides formula parsing, dependency graph recalculation, 400+ Excel functions, dynamic arrays, and deterministic evaluation. No Excel COM or headless LibreOffice is required. Optional LibreOffice integration is still available, but Formualizer is the release-critical backend.
  • Agent-friendly tool design: deterministic JSON contracts, schema and example discovery from the CLI itself, explicit pagination and compact output modes, machine-readable warnings and error envelopes.
  • Safe changes: dry-run workflows, stateless output modes and overwrite safety, event-sourced session editing, verification surfaces for proving downstream results, and structural impact analysis before risky workbook changes.
  • Spreadsheet awareness: region detection, table- and footer-aware append helpers, template row/band cloning, formula-specific replacement and diagnostics, named range CRUD, recalculation + diff + proof workflows.
  • Agent ergonomics: nested command groups with backward-compatible legacy aliases, token-efficient reads, precise singleCell checking and layout checking, providing workflow assistance for repeated parts where agents often make mistakes.

How to use

Main CLI is asp, agent-spreadsheet remains as a compatibility alias. Installation methods include:

  • Shell installer: downloads the prebuilt CLI to ~/.local/bin and creates the asp command. The version can be pinned via ASP_VERSION=0.16.0, set ASP_INSTALL_DIR to choose another target, or pass --mcp to also install the MCP server. This method installs both asp (main command) and agent-spreadsheet (compatibility alias), with no Rust toolchain required.
  • Build from source: includes Formualizer (native Rust recalculation engine).
  • Prebuilt binaries: download raw binaries and archives from GitHub Releases. 0.16 does not provide a native Windows binary; native release verification targets Linux and macOS.

Core workflows include:

  1. Locate the workbook before reading cells.
  2. Precisely inspect the content the agent needs.
  3. Execute a safe stateless edit → recalculate → prove → diff loop.
  4. Preview structural risks before changing the workbook (read-only, showing offset spans, absolute reference warnings, token counts, and optional before/after formula samples).
  5. Use workflow assistance instead of reinventing row logic.
  6. Use stateful sessions when the editing story becomes complex.
  7. Use SheetPort to turn the workbook interface into a contract.

Command groups include: asp analyze ..., asp workbook ..., asp session ..., asp sheetport .... Legacy flat commands are still normalized to the new nested surface where feasible. The CLI has built-in discoverability: when an agent is unsure of the payload shape, it can ask the tool directly, such as asp schema <canonical-op> and asp example <canonical-op>.

Command families:

  • read: extraction and inspection. Combines region detection, structured reading, detailed inspection, and explicit continuation.
  • analyze: search, diagnostics, and impact understanding. Includes ref-impact, formula-trace, and grouped diagnostics.
  • write: safe changes and workflow assistance. LargeMost mutation commands support a strict-mode matrix: --output <PATH>, --in-place, --dry-run. Formula maintenance and named-range maintenance are first-class surfaces.
  • workbook: file-level workflows.
  • verify: prove rather than feel. Check whether target cells changed as expected, whether the workbook introduced new errors, which changes are direct edits vs recalculation consequences, and group the overall changes.
  • session: event-sourced stateful editing. Provides persistent edit state, staged dry-run operations, compare-and-swap apply semantics, logging and replayability, branch/switch/fork workflows, undo/redo/checkout, and explicit materialization back to workbook files.
  • sheetport: spreadsheet interfaces as executable contracts. Includes manifest lifecycle and binding checks + runs.

Output contract: all commands default to JSON. Many also support canonical (preserves the full stable schema) and compact (removes wrapper noise where the contract allows, while preserving continuation fields and command-specific semantics). Deterministic pagination loop: inspect the top-level format before reading payload fields. format=full reads top-level rows plus optional header_row and next_start_row; format=compact reads compact.headers, compact.header_row, compact.rows plus optional next_start_row; format=values_only reads values_only.rows plus optional next_start_row. Continuation is always driven by the top-level next_start_row.

Self-describing payloads: when an agent is unsure what to send, it can request a schema or example. Batch payload examples use a top-level envelope object, and most commands require {"ops":[...]}; column-size-batch prefers {"sheet_name":"...","ops":[...]} and also accepts a per-operation sheet_name inside {"ops":[...]}.

Formula parsing strategy: formula-aware commands support warn (continue and attach grouped diagnostics) and off (silently skip).

CLI reference excerpt: read values <file> <sheet> <range> [range...] [--format dense|json|values|csv] [--include-formulas] read cells <file> <sheet> <target> [target...] [--include-empty] read page <file> <sheet> --format <full|compact|values_only> [--start-row ROW] [--page-size N] workbook create <path> [--sheets Inputs,Calc,...] [--overwrite] analyze find-value <file> <query> [--sheet S] [--mode value|label] [--label-direction right|below|any] write batch transform <file> --ops @ops.json (--dry-run|--in-place|--output PATH)

Applicable Scenarios

Suitable for scenarios that require an agent to handle spreadsheets in a systematic way, such as: reading and analyzing Excel workbooks, safely modifying cells and formulas, verifying change results, managing named ranges, performing batch operations, and turning workbook interfaces into executable contracts. Especially suitable for agent workflows that need to recalculate the actual workbook, track which cells changed and why, and prove the results.

Limitations

  • .xls / .xlsb only support discovery/read-oriented workflows, not writing.
  • 0.16 does not provide Windows native binaries; native release validation targets Linux and macOS.
  • Explicit native sessions automatically start a private log host; SDK/WASM and just-bash sessions keep history in memory; XLSX export saves a document snapshot, not a restartable session log.
  • Persistent fork, checkpoint, staging, and history operations are deliberately not included in stateless CLI discovery.
  • Formula-writing commands clear the cached results of affected formula cells; workbook recalculate must be run to refresh computed values.
  • Other specific features, fees, prices, platforms, or performance information are not provided at this time.