Token Basics
CSV or Excel File in a Prompt? The Dumb Format Mistake That Doubles Your Token Bill
We turned three kinds of spreadsheet into CSV, TSV, Markdown and JSON and counted every version with OpenAI's o200k_base tokenizer. File size is a bad guide, JSON can cost 2.6 times as much as CSV for the same rows, and two columns you probably don't need ate a third of the bill.
Count rows, not kilobytes. On OpenAI's o200k_base tokenizer, a 9-column order export took about 35 tokens per row as CSV, a 12-column numbers sheet 48, and a 7-column support-ticket sheet 83. A 24 KB CSV came to roughly 6,000 to 15,000 tokens. The same rows as pretty-printed JSON cost 1.5 to 2.6 times as much.
| Model | Input $/1M | Cached input $/1M | Output $/1M | Source | Last verified How we verify |
|---|---|---|---|---|---|
| Claude Sonnet 5.5 | $2.00 | $0.10 | $10.00 | Official source | Nov 9, 2026 |
| GPT-5.4 mini | $0.75 | $0.075 | $4.50 | Official source | Nov 5, 2026 |
| Gemini 3.8 Flash | $0.75 | $0.075 | $3.75 | Official source | Nov 4, 2026 |
| GPT-6 Luna | $0.10 | $0.01 | $0.50 | Official source | Nov 5, 2026 |
Prices from official provider pages, verified on the date shown.
8 min read - Published Nov 11, 2026 - Updated Nov 11, 2026
A 24 KB file is not a 24 KB prompt
On November 11, 2026 we took three made-up spreadsheets, saved each one as CSV, TSV, a Markdown table, minified JSON and pretty-printed JSON, and ran every version through o200k_base, the tokenizer OpenAI publishes in its open tiktoken library. Then we saved the same sheets as .xlsx to see how file size lines up with tokens.
It doesn't line up well. One kilobyte of CSV was anywhere from 261 to 626 tokens depending on what was in the cells. One kilobyte of .xlsx was 619 to 1,518 tokens, because .xlsx is a zip file and the text inside is bigger than the file on disk. If you budget from file size, you can be off by a factor of two or more before you've sent a single request.
If you only want your own number, skip the reading: drop the file into the free CSV Token Counter and it gives you tokens and a dollar figure in a few seconds. The rest of this post is what we found when we counted, so you know which parts of a sheet are expensive before you start trimming.
How many tokens per row: three real-looking sheets
The three sheets are the kinds people actually paste into prompts. An order export with 9 columns (order ID, date, city, product, quantity, unit price, total, status, an optional note). A marketing metrics sheet with 12 columns that are almost all numbers. And a support-ticket export with 7 columns where one column is a few sentences of customer text. Each was generated at 100, 1,000 and 10,000 rows with a fixed seed.
| Sheet (1,000 rows) | CSV tokens | Tokens per row | Characters per token | Tokens per KB of CSV |
|---|---|---|---|---|
| Order export, 9 columns | 35,290 | 35 | 2.40 | 427 |
| Metrics, 12 number columns | 48,442 | 48 | 1.64 | 626 |
| Support tickets, 7 columns with text | 82,999 | 83 | 3.93 | 261 |
Tokens per row stayed flat as the sheets grew. At 10,000 rows the order export was 354,339 tokens, almost exactly ten times the 1,000-row count. So once you know the cost of one row, multiplying by the row count is safe. The thing that moves the number is what the columns hold, not how long the file is.
The metrics sheet is mostly digits and ran 1.64 characters per token. The ticket sheet is mostly English and ran 3.93. Same tokenizer, more than twice the tokens per character. Dividing characters by 4 would undercount the metrics sheet by about 59%.
The dumb mistake: sending the sheet as JSON
Most pipelines don't send CSV. They load the sheet into a dataframe or a list of objects and dump it as JSON, because that's what the code already has. That one habit is the most expensive choice in this whole test.
| Sheet | Markdown table | JSON, minified | JSON, pretty-printed |
|---|---|---|---|
| Order export | 1.14x | 1.76x | 2.62x |
| Metrics (numbers) | 1.27x | 1.80x | 2.63x |
| Support tickets (text) | 1.05x | 1.22x | 1.52x |
JSON writes every column name again on every row, plus quotes, colons and braces around every value. Pretty-printing adds a newline and indentation for each field. On sheets with short cells, that wrapping costs more than the data, so the bill more than doubles. On the ticket sheet, where the long text cells dominate, the overhead is smaller but still 52%.
Markdown tables are the middle case. They look tidy in a chat window, and some benchmarks find models answer slightly better from them, but every cell gets a pipe and two spaces. On the all-numbers sheet that added 27%.
What each kind of cell costs
To estimate a sheet you haven't built yet, it helps to know what one cell of each type costs. We tokenized 1,000 cells of each type as a single CSV column, so every figure below includes the comma or line break after the cell.
| Cell type | Example | Tokens per cell |
|---|---|---|
| Small integer | 3 | 2 |
| Status or category word | shipped | 2.5 |
| Integer | 184203 | 3 |
| Price, 2 decimals | 127.45 | 4 |
| Ratio, 4 decimals | 0.0371 | 5 |
| Order ID | ORD-104731 | 5 |
| Product name | Mechanical Keyboard | 5.2 |
| Email address | user48213@example.com | 6 |
| ISO date | 2026-07-14 | 7 |
| One English sentence | The tracking page has said the same thing for four days now. | 13.5 |
| ISO timestamp | 2026-07-14T09:31:00Z | 14 |
| UUID | 3f2b8c1e-... | 23.6 |
Add up the cells in one row and you have tokens per row; multiply by the row count and you have the sheet. The order export works out to about 35 by this method, which matches the real count. A date costs more than a product name. A timestamp costs as much as a full sentence of English. A UUID costs almost twice that.
We deleted just the order ID and order date columns from the 1,000-row order export. Tokens went from 35,290 to 23,305, 34% less, for a question about which products sell in which cities that never needed either column. If the model doesn't need a column to answer, it's paying rent for nothing.
What a 40,000-row, 20-column file costs
Someone searched for exactly this, so we built it: the order export and the metrics sheet side by side, 20 columns, 40,000 rows. As CSV it is 6.1 MB and 3,070,556 tokens, about 77 tokens a row. As pretty-printed JSON it is 8,150,627 tokens. Saved as .xlsx it is 4.8 MB on disk.
First problem: 3 million tokens is three times the 1 million-token context window of the biggest models priced below, so one request can't hold it. You'd send it in chunks, for example 16 requests of 2,500 rows at about 192,000 tokens each. The instructions get repeated in each request, but next to the rows that's a rounding error.
Second problem: the bill. Reading the whole file once, input only, costs $6.14 on Claude Sonnet 5.5 as CSV and $16.30 as pretty-printed JSON. On GPT-5.4 mini it's $2.30 against $6.11, on Gemini 3.8 Flash $2.30 against $6.11, and on GPT-6 Luna $0.31 against $0.82.
One read doesn't sound scary. A nightly job does. Re-reading that file every day for 30 days costs $184.23 on Sonnet 5.5 as CSV and $489.04 as JSON, before the model writes a word. Plug your own row count and model into the AI API Cost Calculator to see your month instead of ours.
What ChatGPT and Claude do with an uploaded spreadsheet
If you drop an .xlsx into ChatGPT, it doesn't read the file as text. OpenAI's help article on data analysis says ChatGPT opens spreadsheets with Python in a sandbox. Claude's code execution tool on the API works the same way and lists CSV and Excel among the files it can process. In both cases the model mostly sees what its code prints: column names, a few rows, the result of a calculation.
That's why a chat app can handle a sheet far bigger than its context window. It's also why the counts in this post matter most for your own code. When a script turns rows into text and puts them in the prompt, every cell is billed, and the format your script picks decides how many tokens those cells become.
How to send fewer tokens for the same answer
- Send CSV or TSV. Only use JSON when the model has to return records in that shape, and then minify it.
- Drop columns the question doesn't use. IDs, timestamps and UUIDs are the priciest cells per value.
- Shorten what you keep: dates instead of timestamps, 2 decimals instead of 6, short codes instead of long labels.
- Aggregate first. A pivot of 40 rows answers most "which region sold more" questions that 40,000 raw rows would.
- For row-by-row jobs like tagging, send rows in batches under one short instruction instead of one request per row.
Before you trust any of these numbers for your own sheet, count it. The free Token Calculator takes a pasted sample, and the CSV Token Counter takes the whole file. If you still estimate with characters divided by 4, read why that rule misses about half the tokens in CSV and JSON. For why the input side is usually the big number here, see input vs output tokens.
Limits of this test
- Only one tokenizer. Claude and Gemini use their own, so their counts will differ. Treat the ratios between formats as more reliable than the exact counts.
- The data is synthetic. Real sheets have messier text, more empty cells and longer IDs, so check your own file.
- The .xlsx files were written by openpyxl with no formatting. Files saved from Excel with styles, extra sheets or images are bigger on disk, so the tokens-per-KB figures for .xlsx are only for plain data sheets.
- Prices come from our dataset and update when providers change them; the token counts don't.
FAQ
How many tokens is a CSV file?
Roughly 260 to 630 tokens per kilobyte of CSV in our test on o200k_base, depending on what the cells hold. Text-heavy sheets sit at the low end and number-heavy sheets at the high end, because digits split into short tokens. Per row, our three test sheets came to 35, 48 and 83 tokens.
Does an Excel file use more tokens than a CSV?
Not by itself. A model never reads the .xlsx bytes; the cells are turned into text first, and you pay for that text. Turned into CSV, an Excel sheet costs the same as the CSV it came from. It costs more if the text ends up as JSON or a padded table, or if hidden sheets and extra columns come along.
How many tokens is a 24 KB file?
A 24 KB CSV was about 6,000 tokens for text-heavy rows and about 15,000 for number-heavy rows in our test. A 24 KB .xlsx holds more, because the file is compressed: our plain data sheets ran 620 to 1,520 tokens per kilobyte of .xlsx, so roughly 15,000 to 36,000 tokens.
Is JSON or CSV cheaper to send to an LLM?
CSV. JSON repeats every column name on every row. For the same rows, minified JSON cost 1.2 to 1.8 times as many tokens as CSV and pretty-printed JSON 1.5 to 2.6 times. TSV matched CSV, and a Markdown table added 5% to 27% for the pipes.
Does ChatGPT or Claude read every cell of a spreadsheet I upload?
Usually not in one go. ChatGPT's data analysis and Claude's code execution tool open spreadsheets with Python, and the model mostly sees what its code prints. The counts here are what you pay when the rows go into the prompt as text, which is what most API pipelines do.
Find out what your sheet costs before you send it.
Upload your CSV to the free CSV Token Counter. It counts tokens row by row and prices the whole file on the model you pick, so the number shows up before the invoice does.