CSV
The input of write_csv. Rows of cells, an optional header, the delimiter and decimals for the reader's locale.
write_csv takes rows of cells and writes a .csv that a spreadsheet opens correctly. Accents survive (a byte order mark is added when the text has non-ASCII characters), text that a spreadsheet would run as a formula is written as text, and amounts keep their decimals when you ask.

Choices for the reader
- Delimiter.
,by default. Use;when the reader's locale writes decimals with a comma. - Decimals. A number loses trailing zeros (1200.50 becomes 1200.5). Set
decimalsper column, or"column"for each column's most decimals, or send the amount as a string. - Locale. With
locale, numbers use that locale's decimal separator. - Header. Written as the first row exactly as given: when the person named the columns, copy their names character for character.
A full example
The input behind the open invoices list. The last customer name starts with =; the file writes it as text.
{
"filename": "invoice-list",
"header": [
"Invoice",
"Customer",
"Issue date",
"Due date",
"Amount",
"Currency",
"Status"
],
"rows": [
[
"INV-2026-0412",
"Acme Supplies Ltd",
"2026-10-02",
"2026-11-01",
1240.5,
"USD",
"Overdue"
],
[
"INV-2026-0418",
"Birch & Co",
"2026-10-09",
"2026-11-08",
830,
"USD",
"Overdue"
],
[
"INV-2026-0425",
"Cobalt Engineering",
"2026-10-16",
"2026-11-15",
4100,
"USD",
"Overdue"
],
[
"INV-2026-0431",
"Delta Retail Group",
"2026-10-23",
"2026-11-22",
2675.25,
"USD",
"Due today"
],
[
"INV-2026-0437",
"Evergreen Cafe",
"2026-10-30",
"2026-11-29",
312.8,
"USD",
"Open"
],
[
"INV-2026-0442",
"Fjord Logistics",
"2026-11-05",
"2026-12-05",
9850,
"USD",
"Open"
],
[
"INV-2026-0447",
"Granite Studios",
"2026-11-12",
"2026-12-12",
1500,
"USD",
"Open"
],
[
"INV-2026-0451",
"=Harbor Marine",
"2026-11-16",
"2026-12-16",
760,
"USD",
"Open"
]
],
"bom": true
}Fields
Generated from the schema the tools send to the model. A field with ? is optional.
| Field | Type | Description |
|---|---|---|
filename? | string (max 120 chars) | File name without folders, e.g. 'Open invoices'. The .csv extension is added. |
header? | string[] (at most 500) | Column names, written as the first row exactly as given. When the person named the columns, copy their names character for character: same case (lower case stays lower case), accents, spelling and order |
rows | ((string | number | boolean | null)[])[] (at most 100,000) | Data rows; each row is a list of cells. A number loses trailing zeros (1200.50 becomes 1200.5): send an amount whose decimals must stay as a string, or set decimals |
delimiter? | "," | ";" | "\t" | Default ','. Use ';' when the reader's locale writes decimals with a comma |
bom? | boolean | Start with a UTF-8 byte order mark so Excel reads accents correctly. Default: only when the text has non-ASCII characters |
locale? | string (min 2 chars, max 35 chars) | BCP 47 tag; when set, numbers use that locale's decimal separator |
decimals? | "column" | (integer | null)[] | Decimals of number cells: one count per column (null leaves a column as is), e.g. [null, 2] writes 1200.5 as 1200.50; or 'column' for each column's most decimals |