From Spreadsheets to LLMs: Converting Excel & CSV Data to TOON
Got rows of spreadsheet data to analyze with AI? Learn when to send it as CSV, TOON, or TONL, and how to convert Excel and Sheets exports into token-efficient prompts.
To send Excel or Google Sheets data to an LLM efficiently: export to CSV, filter to only the rows you need, then convert to TOON. TOON cuts up to 58.8% of tokens on flat tabular data versus JSON, adds an explicit row count the model can validate, and handles multi-sheet or typed data that raw CSV cannot represent.
Why Spreadsheet Data Is a Natural Fit for TOON
A spreadsheet is, at its core, a uniform table: a fixed set of column names that apply to every row. That structural regularity is exactly what TOON's table block is designed to exploit. According to the official toonformat.dev benchmarks — 5,016 LLM calls, 209 questions, six formats, four models — flat uniform tables in TOON use 58.8% fewer tokens than JSON arrays of objects (67,778 vs 164,452 tokens). Overall, TOON achieves 39.9% fewer tokens than JSON while delivering 76.4% retrieval accuracy and an extraordinary 99.6% accuracy on field retrieval tasks.
An independent research paper, "Talking with Tables for Better LLM Factual Data Interactions" (arXiv 2412.17189, updated January 2026), reinforces this from a different angle. Providing data as tabular structures yields a 40.29% average performance gain over text blended with semi-structured formats such as JSON or knowledge graphs. Attention analysis in the same paper shows that tabular layouts help LLMs attend to relevant cells more reliably — which is why the format matters, not just the content.
Both findings point in the same direction: preserve the tabular structure of your spreadsheet data when you send it to a model, and use a format that does so without paying the per-row overhead JSON requires.
CSV vs. TOON vs. TONL: Spreadsheet Rows as All Three
Consider a small sales sheet with five rows and four columns. Here is the same data in all three formats, so the structural differences are concrete.
-- Original spreadsheet (Sales sheet, 5 rows)
| month | region | units_sold | revenue_usd |
|----------|--------|------------|-------------|
| Jan 2026 | North | 820 | 41000.00 |
| Jan 2026 | South | 540 | 27000.00 |
| Feb 2026 | North | 910 | 45500.00 |
| Feb 2026 | South | 630 | 31500.00 |
| Mar 2026 | North | 780 | 39000.00 |
-- CSV export — zero structural overhead, universally understood
month,region,units_sold,revenue_usd
Jan 2026,North,820,41000.00
Jan 2026,South,540,27000.00
Feb 2026,North,910,45500.00
Feb 2026,South,630,31500.00
Mar 2026,North,780,39000.00
-- TOON — explicit row count + field header; values only per row
sales[5]{month,region,units_sold,revenue_usd}:
Jan 2026, North, 820, 41000.00
Jan 2026, South, 540, 27000.00
Feb 2026, North, 910, 45500.00
Feb 2026, South, 630, 31500.00
Mar 2026, North, 780, 39000.00CSV and TOON are nearly identical in token cost for this purely flat sheet. TOON's advantage is the header line sales[5]{month,region,units_sold,revenue_usd}:, which tells the model exactly how many rows to expect and names the fields explicitly — a built-in schema the model can validate against. CSV's header row names the fields but provides no row count.
For multi-sheet workbooks, CSV requires splitting into separate files. TOON represents each sheet as a named block in a single document. A workbook with a Sales sheet and a Products sheet becomes:
sales[5]{month,region,units_sold,revenue_usd}:
Jan 2026, North, 820, 41000.00
Jan 2026, South, 540, 27000.00
Feb 2026, North, 910, 45500.00
Feb 2026, South, 630, 31500.00
Mar 2026, North, 780, 39000.00
products[3]{sku,name,price_usd,in_stock}:
P001, Widget A, 49.99, true
P002, Widget B, 89.95, true
P003, Widget C, 129.00, falseThis is the multi-sheet case where TOON provides genuine structural value over CSV. See the CSV vs TOON comparison for a full breakdown of when CSV's simplicity wins versus when TOON's structure is worth the brief format instructions.
CSV vs. TOON vs. TONL for Spreadsheet Data: Which to Choose
| Scenario | CSV | TOON | TONL |
|---|---|---|---|
| Single flat sheet, small (<50 rows) | Best — zero overhead, universally understood | Good, but prompt tax may not amortize | Overkill for this size |
| Single flat sheet, large (50+ rows) | Good — competitive token cost | Best — up to 58.8% fewer tokens than JSON; explicit row count | Also good; adds query API at cost of extra syntax |
| Multi-sheet workbook | Requires multiple files | Best — named blocks in one document | Also handles multi-block documents |
| Typed columns (dates, booleans, numbers) | Weak — all values become strings | Good — preserves types natively | Best — explicit type hints (u32, bool, str) enable schema validation |
| Very large export (GB-scale) needing streaming | Possible but no query API | No built-in streaming | Best — streams 50GB+ in <100MB memory; query API <0.1ms |
| LLM familiarity (no instructions needed) | Universal | Requires brief format instructions | Requires format instructions |
The key insight from the TONL documentation is that TONL's streaming capability — 50GB+ files processed in under 100MB of memory with a query API returning results in under 0.1ms — addresses the use case that neither CSV nor plain TOON can: very large spreadsheet exports from data warehouse tools or large ERP systems where you need to filter or project columns before even seeing the data. For that scenario, TONL is the correct choice. For most analyst workflows with exports under a few thousand rows, TOON or CSV is sufficient.
For a detailed comparison of TOON and TONL, see the CSV vs TONL guide.
Step-by-Step: From Excel Export to LLM Prompt
The practical workflow for most analysts and developers is straightforward:
- Filter in the spreadsheet first. Apply Excel filters, a pivot table, or Google Sheets filter views to reduce rows to only what the LLM needs. The toonformat.dev benchmark shows in-context filtering accuracy of only 56.8% — the database or spreadsheet tool is more reliable and produces a smaller payload.
- Export to CSV. File → Download → CSV (or Save As CSV in Excel). This is the universal intermediate format every tool understands.
- Convert CSV to TOON. Paste the CSV into the free json2toon.co converter, select TOON as the output format, and copy the result. For multi-sheet workbooks, convert each sheet separately and combine the named TOON blocks.
- Include a brief format note in your system prompt. One or two sentences describing the
tablename[n]{field1,field2}:syntax is enough for any modern model. Pay this cost once per conversation, not per message. - Paste the TOON block into your user or context message. The model receives the full table with an explicit row count it can use to verify it read everything.
For JSON exports from tools like Airtable or Notion (which often produce arrays of objects), the same converter handles JSON input and outputs TOON. The conversion is lossless for flat and moderately nested structures.
Filter Before You Send: Why In-Context Aggregation Fails
A common mistake is sending an entire spreadsheet export and asking the LLM to compute totals, averages, or filtered subsets. The toonformat.dev benchmark is specific about where TOON accuracy degrades: aggregation tasks drop to 61.9% accuracy and filtering tasks drop to 56.8%, compared to 99.6% for field retrieval.
This is not a TOON-specific weakness — it reflects the general difficulty LLMs have with arithmetic and set operations across large in-context datasets. The correct pattern is to use a spreadsheet formula, a pivot table, or a brief script to pre-compute the answer, then send the computed result to the LLM for interpretation or narrative generation. The LLM's strength is reasoning about the numbers, not computing them.
For a deeper treatment of when to offload computation versus when to let the LLM handle it, see the JSON vs TOON comparison, which covers the accuracy-per-task breakdown across all question types.
Understanding CSV Limitations for Spreadsheet-to-LLM Workflows
CSV is the right starting point for most workflows precisely because of its universality. Every LLM has seen enormous amounts of CSV data during training and requires no format instructions. For a flat, single-sheet export, plain CSV has zero structural overhead and competitive token cost — it may even slightly outperform TOON on very small datasets where the prompt-tax overhead of TOON's format instructions is not amortized.
CSV's limitations become relevant in three situations. First, typed columns: CSV represents everything as a string, so a boolean column like in_stock or a date column loses its type information. Second, multi-sheet workbooks: CSV is one table per file, so representing a relational structure requires multiple files and explicit instructions about how they relate. Third, an explicit row count: CSV's header row names columns but does not declare how many data rows follow, so the model cannot verify it received the complete export.
TOON addresses all three limitations while keeping token cost close to CSV for flat data and well below JSON for larger datasets. For a complete treatment of CSV's role in LLM workflows, see understanding CSV.
Frequently Asked Questions
How do I send Excel or Google Sheets data to an LLM efficiently?
Export the sheet to CSV, then convert it to TOON using a tool like json2toon.co. For a flat single sheet, plain CSV works and every model understands it. TOON adds an explicit row count and field header, cuts up to 58.8% of tokens on flat tabular data, and handles multi-sheet or typed data that CSV cannot represent cleanly.
Should I send the whole spreadsheet to the LLM or just the relevant rows?
Always filter first. The toonformat.dev benchmark shows LLM filtering accuracy drops to 56.8% in-context. Use Excel filters, a pivot table, or a SQL query on the exported CSV to reduce the dataset to only the rows the LLM actually needs. Smaller input means lower cost and higher accuracy.
How does TOON handle multi-sheet Excel workbooks?
Each sheet maps to a named TOON table block. A workbook with a Sales sheet and a Products sheet becomes two separate table blocks in the same TOON document, each with its own row count and field header. This nesting is something CSV cannot represent at all without splitting into multiple files.
When should I use TONL instead of TOON for spreadsheet data?
Use TONL when the spreadsheet export is very large and you need to query it without loading it fully into memory, or when you need schema validation and TypeScript type generation. TONL streams files larger than 50GB in under 100MB of memory and provides a query API with indexed lookups under 0.1ms — capabilities plain TOON does not offer.
Does TOON actually improve LLM accuracy on spreadsheet data?
Yes, for field retrieval. The official toonformat.dev benchmark recorded 99.6% field retrieval accuracy with TOON and 76.4% overall accuracy across all question types, while using 39.9% fewer tokens than JSON. An independent arXiv study (2412.17189) also found tabular structures yield a 40.29% average performance gain over semi-structured formats for factual data tasks.
Recommended Reading
CSV vs TOON: Which Format for Your LLM Data?
Compare CSV vs TOON for LLM prompts: flat vs structured data, type safety, token efficiency, and when to use each format.
Feeding SQL Query Results to LLMs: TOON vs JSON Result Sets
A SQL result set is a uniform table—TOON's best case. See how converting query rows to TOON cuts up to 58.8% of tokens while keeping field retrieval near-perfect.
Halving Costs Twice: The OpenAI Batch API Plus TOON
The Batch API takes 50% off input and output tokens; TOON removes 40-60% of them first. Here's how to combine async batching and token-efficient formatting for bulk LLM jobs.