POST /excel/analyze is the read-only variant of /excel/generate. It runs the Excel agent in mode=ask against a previously uploaded file and returns a plain-text answer in a JSON envelope — no document is produced, no storage writes happen. Use it when you want to query an existing spreadsheet without modifying it.
Typical use cases include customer-facing Q&A over uploaded workbooks, summarization pipelines over structured data, and data validation checks (“does this budget balance?”, “are there any #REF! errors?”).
How it differs from /excel/generate
/excel/generate | /excel/analyze | |
|---|---|---|
| Produces a file | Yes (download_url) | No |
| Mode | action (writes) | ask (read-only) |
| Returns | File + summary | Free-form text answer |
| Creates a run row | Yes | No (ephemeral) |
| Typical cost | 20–200 credits | 5–20 credits |
| Typical latency | 15–60s | 3–15s |
Request parameters
The
file_id of a previously uploaded .xlsx, .xls, or .csv file. You must upload the file first using POST /files (purpose: "reference") to get this ID.Your natural-language question or instruction. Up to 5,000 characters. Be as specific as possible — reference sheet names, column headers, or cell ranges when you know them.
Step-by-step
Upload the workbook
Upload your
.xlsx (or .csv) file and store the returned file_id. This is a one-time step — you can reuse the same file_id for multiple analyze calls.Response shape
| Field | Description |
|---|---|
answer | Free-form text answer to your question. May include markdown formatting. |
run_id | An ephemeral identifier for this analysis. Not reusable for follow-up turns. |
tool_calls | Number of read operations the agent performed internally. |
credits_used | Credits deducted for this call. |
POST /excel/analyze does not produce a file and does not create a persistent run row. If you want the analysis embedded in a new workbook, use /excel/generate instead: “create a summary workbook of this data”.Example prompts
- Direct questions
- Cross-sheet reasoning
- Summaries
- Validations
Ask about specific values, totals, or counts:
"What's the total revenue on the Income sheet?""How many rows are in the Employees sheet?""What's the average salary for engineering roles?""What was total Q3 revenue across all regions?"
What the agent can see
The agent gets the full workbook structure: sheet names, column headers, cell values, formulas, and conditional formatting rules. It uses the same read actions as the generate endpoint — the key difference is that it never performs any write operations on the file.Supported file formats
| Format | Notes |
|---|---|
.xlsx | Primary format — all features supported |
.xls | Older Excel format, read via openpyxl |
.csv / .tsv | Treated as a single-sheet workbook |
400 invalid_request.
Limitations
- Answer length is capped at approximately 2,000 tokens. For very long answers, break your question into smaller, focused calls or ask for a summary first.
- No structured citation list. The agent mentions sheet names and ranges in prose but does not return a machine-readable list of source cells.
- No file output. This endpoint is read-only. To produce a document from the analysis, use
POST /excel/generate.
Tips for better results
- Reuse the same
file_idfor multiple questions — you only need to upload the file once. - For large workbooks, tell the agent which sheet to focus on to reduce unnecessary reads.
- If you need a specific number format in the answer (e.g., “in millions with two decimal places”), include that in your prompt.
Related
- Excel guide — generate or edit workbooks with
POST /excel/generate - Runs and tasks — run lifecycle and task polling
- Credits — analyze calls cost 5–20 credits depending on workbook size

