Data & spreadsheets

New tool shrinks spreadsheet data for AI agents by 1000x

Sheetgraph converts complex Excel and Google Sheets files into compact reports, allowing AI agents to analyze large datasets without exceeding token limits.

Illustration of a spreadsheet being analyzed and compressed into a logical map
Illustration created for this article

A new open-source utility called sheetgraph has been released to help artificial intelligence agents interpret complex spreadsheets without consuming excessive computational resources. Created by the team behind Love Spreadsheets, this Rust-based tool processes Excel and Google Sheets files locally, generating concise summaries that retain critical logical structures while discarding repetitive data.

What happened

The primary challenge addressed by this release is the inability of current large language models to efficiently process raw spreadsheet dumps. A typical workbook containing hundreds of thousands of cells can require millions of tokens to represent as plain text, which is often prohibitively expensive or technically impossible for standard AI context windows. Sheetgraph solves this by extracting the underlying logic of the spreadsheet rather than just its raw values. It produces a short markdown report and a formula dependency graph, reducing the data footprint by approximately one thousand times.

For example, an invoice ledger with 120,000 cells and 32,000 formulas would normally require about 1.3 million tokens to dump as text. With sheetgraph, the same file is compressed into a report of roughly 7,000 tokens. The tool achieves this compression by identifying patterns, such as columns where every cell uses the same formula, and representing them as a single group. It also highlights inconsistencies, such as cells where a user has manually typed over a formula, which are common sources of errors in financial models.

Key details

  • Massive token reduction: The tool reduces data size by roughly 1000x, turning a 961,000-token job tracker into a 940-token report.
  • Local processing: Written in Rust, the binary runs locally on macOS, Linux, and Windows, ensuring sensitive data never leaves the user's machine.
  • Formula dependency tracking: It maps sheet-to-sheet data flow, lookups, and external links, allowing agents to trace the precedents and dependents of any specific cell.
  • Error detection: The report explicitly identifies where formula columns are broken by hardcoded values, making it easier to spot manual overrides.
  • Agent integration: It ships as a skill for Claude Code and can be integrated into other agents like Codex and Cursor via a simple skills folder configuration.
  • Broad format support: It supports xlsx, xlsm, xls, xlsb, ods, csv, and Google Sheets, handling up to 10 million cells in local files.

Background

To understand the value of this tool, it helps to recognize how spreadsheets store data versus how AI models read it. Spreadsheets are highly structured, with many cells sharing identical formulas or formatting. However, when converted to plain text for an AI, this structure is lost, and every single cell is treated as unique information. This redundancy bloats the context window, which is the limited amount of text an AI can consider at one time.

Sheetgraph acts as a translator between these two worlds. Instead of sending every number, it sends a map. It groups identical formulas into "copy-groups" and summarizes large data blocks by their column profiles, such as data type, range, and format. This allows the AI to understand the schema and logic of the workbook without needing to read every individual row. It is inspired by similar tools used for codebases, but adapted specifically for the unique challenges of tabular data and spreadsheet logic.

Why it matters

For teams that rely on self-hosted software or internal data tools, this development significantly lowers the barrier to using AI for data analysis. Previously, asking an AI to audit a complex financial model or debug a broken inventory sheet was risky due to cost and privacy concerns. By keeping processing local and reducing the data volume, engineers can now safely point AI agents at sensitive workbooks to ask high-level questions like "why is this total off?" or "what does this workbook do?"

This also improves the accuracy of AI responses. When an agent has access to the formula dependency graph, it can trace errors back to their source rather than guessing based on static values. It can distinguish between a calculated field and a hardcoded override, which is crucial for maintaining data integrity. For IT leads managing internal tools, this means AI can become a viable partner in maintaining legacy Excel-based workflows that have not yet been migrated to proper databases.

What you can do

  • Install the tool on your local machine using the provided curl script for macOS and Linux, or download the zip file for Windows.
  • Integrate sheetgraph as a skill in your AI coding assistant, such as Claude Code, to enable automatic spreadsheet analysis during chats.
  • Run the extract command on a sample workbook to generate a REPORT.md and review how the tool summarizes your specific data structures.
  • Use the trace command to investigate specific cells that seem incorrect, allowing the AI to follow the chain of dependencies automatically.
  • Test the tool on large files to verify memory usage, noting that files up to 10 million cells are kept whole, while larger ones are summarized to stay within 2-3 GB of RAM.
  • Report any bugs or unexpected behaviors to the GitHub repository, as the project is currently in beta version 0.1 and the API may change.

More news

All news