POST /excel/generate turns a natural-language prompt into a fully formatted .xlsx workbook. The agent writes data, applies formulas, styles headers, freezes panes, creates charts, and builds multi-sheet workbooks in a single call — no templates or manual formatting required. Use it to automate sales reports, financial models, data dashboards, and any other spreadsheet you’d otherwise build by hand.
Request parameters
Natural-language description of the workbook you want. Up to 10,000 characters. Be specific about structure, columns, and intent — the more context you give, the better the output.
Resume an existing run. Pass the
run_id from a previous response to add columns, restyle, or extend the workbook. Follow-up turns are faster and cheaper because the agent already knows the sheet structure.file_id of an existing .xlsx to edit in-place instead of creating a new workbook. Upload the file first with POST /files (purpose: "init").Reference files to read data from. Each entry is an object with
file_id and kind (e.g., "csv"). The agent reads the schema and uses the data directly.Images to embed in the workbook. Each entry is an object with
image_id and tags. Upload images first with POST /images.Set to
true to run the job asynchronously. The response returns a task_id immediately. Use webhook_url to receive the result, or poll GET /tasks/{task_id}.Override the default output filename.
Supply a unique key to safely retry requests without producing duplicate runs.
Quickstart
Generate a workbook
Send a prompt describing what you want. The response includes a
download_url for the finished .xlsx.Response shape
A successful synchronous response looks like this:| Field | Description |
|---|---|
run_id | Use this to resume the run or export to another format. |
download_url | Signed URL for the .xlsx file. Valid for 1 hour. |
summary | Agent’s description of what it built. |
credits_used | Credits deducted for this call. |
Common use cases
Working from an uploaded CSV
Upload a source file first, then reference it in the prompt. The agent reads the schema and builds the workbook from your data.Editing an existing workbook
Passinit_file to edit in-place instead of creating a fresh workbook.
Financial models
For three-statement models, DCFs, or LBOs, describe your intent and the agent loads a specialized template automatically.=Assumptions.C5), a balance check (Assets = Liabilities + Equity), cash reconciliation, yellow-highlighted input cells, and per-column number formatting.
Iterating with run_id
Passrun_id to build incrementally. Follow-up turns are much cheaper because the agent already knows the sheet structure, column names, and row count.
Exporting to other formats
Convert a completed run to PDF, CSV, PNG, or HTML usingPOST /runs/{run_id}/export.
pdf, csv, png, html.
What the agent handles well
- Formulas: cross-sheet references,
INDEX/MATCH,VLOOKUP,SUM,COUNTIF, and more - Number formatting: currency, percentage, date, custom patterns, thousand separators
- Conditional formatting: threshold rules, color scales, data bars, icon sets
- Charts: column, bar, line, pie, doughnut, combo, scatter, bubble, stock, radar
- Pivot-style summary tables: grouped totals, averages, counts
- View settings: freeze panes, auto-filters, column widths, row heights
Things to be aware of
- No macros or VBA. The agent uses cell-level formulas only.
- Placeholder data is generated when the prompt asks for data the agent doesn’t have. The
summaryfield in the response notes when this happens. - Chart type selection is agent-driven. If a specific chart type matters, say so explicitly in your prompt (“use a bar chart”).
Tips for better results
- Specify currencies, date formats, and fiscal year conventions upfront.
- Name the sheets you want if the layout matters to you.
- For financial models, mention the time horizon and accounting basis (e.g., “5-year horizon, accrual, USD”).
- Ask for
async: trueon large workbooks to avoid timeout issues.
Related
- Runs and tasks — understand
run_id, task polling, and run lifecycle - Async vs sync — when to use
async: trueand how to poll or receive webhooks - Analyze an Excel file — ask questions of an uploaded workbook without producing a new file
- Credits — how generation costs are calculated

