Workbook spec
The WorkbookSpec that create_workbook takes. Sheets of cells with live formulas, roles, styles, tables, names and native charts.
A WorkbookSpec lists sheets of cells. Every derived number is a formula in English function names; inputs are plain values with role: "input", which the compiler colours blue on pale yellow. Tables, named ranges, conditional formats, validations and native charts are declared on the sheet; the compiler writes the XML, the styles and the number formats.

Smallest example
{
"filename": "plan",
"spec": {
"locale": "en-US",
"sheets": [
{
"name": "Plan",
"cells": [
{ "ref": "A1", "value": "Unit price" }, { "ref": "B1", "value": 120, "role": "input" },
{ "ref": "A2", "value": "Units" }, { "ref": "B2", "value": 40, "role": "input" },
{ "ref": "A3", "value": "Revenue" }, { "ref": "B3", "formula": "=B1*B2" }
]
}
]
}
}Rules the checks enforce
- Live formulas. A number derived from other cells is a formula, never a typed result (W1).
- Inputs in labelled cells. Formulas point at input cells or names, not typed constants (W2).
- Formats on every number. Money with a currency, percentages, dates as
YYYY-MM-DDstrings that the compiler stores as real dates (W4). - English formula syntax. English function names and commas; Excel shows them localised (W5).
- No missing sheets or names. A formula that refers to a sheet or name that does not exist is an error, and no file is made.
A full example
The spec behind the cash-flow plan in the example files.
{
"filename": "cash-flow-plan",
"spec": {
"locale": "en-US",
"title": "Cash flow plan H1 2027",
"styles": [
{
"id": "title",
"bold": true,
"fontSize": 14
},
{
"id": "head",
"bold": true,
"fill": "E5EDF5",
"align": "right",
"border": "bottom"
},
{
"id": "headLeft",
"bold": true,
"fill": "E5EDF5",
"border": "bottom"
},
{
"id": "usd",
"numFmt": "\"$\"#,##0"
},
{
"id": "pct",
"numFmt": "0%"
},
{
"id": "total",
"bold": true,
"numFmt": "\"$\"#,##0",
"border": "top"
}
],
"sheets": [
{
"name": "Cash flow",
"freeze": {
"rows": 8,
"cols": 1
},
"columns": [
{
"col": "A",
"width": 30
},
{
"col": "B",
"width": 11
},
{
"col": "C",
"width": 11
},
{
"col": "D",
"width": 11
},
{
"col": "E",
"width": 11
},
{
"col": "F",
"width": 11
},
{
"col": "G",
"width": 11
},
{
"col": "H",
"width": 12
}
],
"cells": [
{
"ref": "A1",
"value": "Cash flow plan, January to June 2027",
"style": "title"
},
{
"ref": "A3",
"value": "Opening cash",
"role": "label"
},
{
"ref": "B3",
"value": 40000,
"role": "input",
"style": "usd",
"note": "Bank balance on 31 December 2026"
},
{
"ref": "A4",
"value": "Monthly growth in sales",
"role": "label"
},
{
"ref": "B4",
"value": 0.04,
"role": "input",
"style": "pct"
},
{
"ref": "A5",
"value": "Materials, share of sales",
"role": "label"
},
{
"ref": "B5",
"value": 0.38,
"role": "input",
"style": "pct"
},
{
"ref": "A6",
"value": "Rent and salaries per month",
"role": "label"
},
{
"ref": "B6",
"value": 21000,
"role": "input",
"style": "usd"
},
{
"ref": "A8",
"value": "Month",
"style": "headLeft"
},
{
"ref": "B8",
"value": "Jan 2027",
"style": "head"
},
{
"ref": "C8",
"value": "Feb 2027",
"style": "head"
},
{
"ref": "D8",
"value": "Mar 2027",
"style": "head"
},
{
"ref": "E8",
"value": "Apr 2027",
"style": "head"
},
{
"ref": "F8",
"value": "May 2027",
"style": "head"
},
{
"ref": "G8",
"value": "Jun 2027",
"style": "head"
},
{
"ref": "H8",
"value": "Total",
"style": "head"
},
{
"ref": "A9",
"value": "Sales",
"role": "label"
},
{
"ref": "B9",
"value": 52000,
"role": "input",
"style": "usd"
},
{
"ref": "C9",
"formula": "=B9*(1+$B$4)",
"role": "calc",
"style": "usd"
},
{
"ref": "D9",
"formula": "=C9*(1+$B$4)",
"role": "calc",
"style": "usd"
},
{
"ref": "E9",
"formula": "=D9*(1+$B$4)",
"role": "calc",
"style": "usd"
},
{
"ref": "F9",
"formula": "=E9*(1+$B$4)",
"role": "calc",
"style": "usd"
},
{
"ref": "G9",
"formula": "=F9*(1+$B$4)",
"role": "calc",
"style": "usd"
},
{
"ref": "A10",
"value": "Materials",
"role": "label"
},
{
"ref": "B10",
"formula": "=-B9*$B$5",
"role": "calc",
"style": "usd"
},
{
"ref": "C10",
"formula": "=-C9*$B$5",
"role": "calc",
"style": "usd"
},
{
"ref": "D10",
"formula": "=-D9*$B$5",
"role": "calc",
"style": "usd"
},
{
"ref": "E10",
"formula": "=-E9*$B$5",
"role": "calc",
"style": "usd"
},
{
"ref": "F10",
"formula": "=-F9*$B$5",
"role": "calc",
"style": "usd"
},
{
"ref": "G10",
"formula": "=-G9*$B$5",
"role": "calc",
"style": "usd"
},
{
"ref": "A11",
"value": "Rent and salaries",
"role": "label"
},
{
"ref": "B11",
"formula": "=-$B$6",
"role": "calc",
"style": "usd"
},
{
"ref": "C11",
"formula": "=-$B$6",
"role": "calc",
"style": "usd"
},
{
"ref": "D11",
"formula": "=-$B$6",
"role": "calc",
"style": "usd"
},
{
"ref": "E11",
"formula": "=-$B$6",
"role": "calc",
"style": "usd"
},
{
"ref": "F11",
"formula": "=-$B$6",
"role": "calc",
"style": "usd"
},
{
"ref": "G11",
"formula": "=-$B$6",
"role": "calc",
"style": "usd"
},
{
"ref": "A12",
"value": "Net cash flow",
"role": "label",
"style": {
"bold": true
}
},
{
"ref": "B12",
"formula": "=SUM(B9:B11)",
"role": "calc",
"style": "total"
},
{
"ref": "C12",
"formula": "=SUM(C9:C11)",
"role": "calc",
"style": "total"
},
{
"ref": "D12",
"formula": "=SUM(D9:D11)",
"role": "calc",
"style": "total"
},
{
"ref": "E12",
"formula": "=SUM(E9:E11)",
"role": "calc",
"style": "total"
},
{
"ref": "F12",
"formula": "=SUM(F9:F11)",
"role": "calc",
"style": "total"
},
{
"ref": "G12",
"formula": "=SUM(G9:G11)",
"role": "calc",
"style": "total"
},
{
"ref": "A13",
"value": "Closing cash",
"role": "label",
"style": {
"bold": true
}
},
{
"ref": "B13",
"formula": "=$B$3+B12",
"role": "calc",
"style": "total"
},
{
"ref": "C13",
"formula": "=B13+C12",
"role": "calc",
"style": "total"
},
{
"ref": "D13",
"formula": "=C13+D12",
"role": "calc",
"style": "total"
},
{
"ref": "E13",
"formula": "=D13+E12",
"role": "calc",
"style": "total"
},
{
"ref": "F13",
"formula": "=E13+F12",
"role": "calc",
"style": "total"
},
{
"ref": "G13",
"formula": "=F13+G12",
"role": "calc",
"style": "total"
},
{
"ref": "H9",
"formula": "=SUM(B9:G9)",
"role": "calc",
"style": "usd"
},
{
"ref": "H10",
"formula": "=SUM(B10:G10)",
"role": "calc",
"style": "usd"
},
{
"ref": "H11",
"formula": "=SUM(B11:G11)",
"role": "calc",
"style": "usd"
},
{
"ref": "H12",
"formula": "=SUM(B12:G12)",
"role": "calc",
"style": "total"
}
],
"charts": [
{
"type": "column",
"title": "Closing cash by month",
"anchor": "A15",
"widthCols": 8,
"heightRows": 16,
"categories": "'Cash flow'!$B$8:$G$8",
"series": [
{
"name": "Closing cash",
"values": "'Cash flow'!$B$13:$G$13",
"color": "1F4E79"
}
],
"yAxis": {
"numFmt": "\"$\"#,##0"
},
"legend": "none"
}
]
}
]
}
}Fields
Generated from the schema the tools send to the model. A field with ? is optional.
| Field | Type | Description |
|---|---|---|
version? | 1 | |
locale? | string | BCP 47 tag for number and date formats; default from the host settings |
title? | string (max 255 chars) | Workbook title in sentence case |
accounting? | boolean | Money and amount formats in the accounting style: (1,200) for negatives in English locales, a dash for zero, thousands separators. Default true; false keeps formats exactly as given |
font? | object | Workbook font; default Calibri 11 |
styles? | object[] (at most 100) | |
names? | object[] (at most 500) | |
sheets | object[] (at least 1, at most 50) |
font
Workbook font; default Calibri 11
| Field | Type | Description |
|---|---|---|
name | string (max 64 chars) | |
size? | number (min 6, max 24) |
styles[]
| Field | Type | Description |
|---|---|---|
bold? | boolean | |
italic? | boolean | |
fontSize? | number (min 6, max 48) | |
fontColor? | string | |
fill? | string | |
numFmt? | string (max 255 chars) | |
align? | "left" | "center" | "right" | |
valign? | "top" | "middle" | "bottom" | |
wrap? | boolean | |
indent? | integer (min 0, max 10) | |
border? | "none" | "thin" | "medium" | "bottom" | "top" | "topBottom" | "doubleBottom" | |
id | string (max 64 chars) |
names[]
| Field | Type | Description |
|---|---|---|
name | string (max 255 chars) | |
ref | string (min 2 chars) | Sheet-qualified target, e.g. 'Assumptions'!$B$3 |
comment? | string (max 255 chars) |
sheets[]
| Field | Type | Description |
|---|---|---|
id? | string (max 64 chars) | |
name | string (max 31 chars) | |
title? | string | false | Title row written in A1 (the sheet moves down to make room). Default: the workbook title on the first sheet; false for none |
tabColor? | string | |
columns? | object[] | |
freeze? | object | |
cells? | object[] (at most 50,000) | |
tables? | object[] (at most 20) | |
merges? | string[] (at most 500) | |
conditionalFormats? | object[] (at most 100) | |
validations? | object[] (at most 100) | |
charts? | object[] (at most 20) | |
gridlines? | boolean | Cell gridlines on screen. Default: hidden on a sheet with a table or a row of headers, shown elsewhere |
landscape? | boolean | |
notes? | string[] (at most 6) | Short lines under the sheet's tables (italic, grey): how to read it, sources, assumptions, what the placeholder colour means |
autofilter? | string | Filter buttons on the header row of this range (tables have their own) |
sparklines? | object[] (at most 1,000) | |
print? | object |
sheets[].columns[]
| Field | Type | Description |
|---|---|---|
col | string | |
width? | number (min 0, max 255) | |
hidden? | boolean |
sheets[].freeze
| Field | Type | Description |
|---|---|---|
rows | integer (min 0, max 100) | |
cols | integer (min 0, max 50) |
sheets[].cells[]
| Field | Type | Description |
|---|---|---|
ref | string | A1 cell reference on the same sheet, e.g. B3 |
value? | string | number | boolean | null | Literal value. Numbers as numbers, never as formatted text. |
formula? | string | Excel formula in English function names, with or without leading '='. Use for every derived number. |
role? | "input" | "calc" | "link" | "header" | "label" | "total" | "note" | |
style? | string | object | Named style id or inline style |
note? | string (max 2,000 chars) | Cell comment, e.g. the source of an assumption |
placeholder? | boolean | The value is a stand-in the brief did not give: shown marked for the user to replace. In text, [[Name]] marks one too. |
sheets[].cells[].style
| Field | Type | Description |
|---|---|---|
bold? | boolean | |
italic? | boolean | |
fontSize? | number (min 6, max 48) | |
fontColor? | string | |
fill? | string | |
numFmt? | string (max 255 chars) | |
align? | "left" | "center" | "right" | |
valign? | "top" | "middle" | "bottom" | |
wrap? | boolean | |
indent? | integer (min 0, max 10) | |
border? | "none" | "thin" | "medium" | "bottom" | "top" | "topBottom" | "doubleBottom" |
sheets[].tables[]
| Field | Type | Description |
|---|---|---|
id? | string (max 64 chars) | |
name? | string (max 255 chars) | |
at | string | Top-left cell of the header row |
columns | object[] (at least 1, at most 100) | |
rows | ((string | number | boolean | null | object)[])[] (at most 1,000,000) | Data rows; [] when rowsFrom names a CSV file |
rowsFrom? | string (max 1,024 chars) | A CSV file the caller loads into rows (its header row is skipped), for large data; the engine never reads files |
banded? | boolean | |
totalsRow? | boolean |
sheets[].tables[].columns[]
| Field | Type | Description |
|---|---|---|
header | string (max 255 chars) | |
numFmt? | string (max 255 chars) | |
role? | "input" | "calc" | "link" | "header" | "label" | "total" | "note" | |
width? | number (min 1, max 255) | |
total? | "sum" | "average" | "count" | "min" | "max" | "none" |
sheets[].conditionalFormats[]
| Field | Type | Description |
|---|---|---|
range | string | A1 range on the same sheet, e.g. B2:B13 |
rule | object | |
style? | object |
sheets[].conditionalFormats[].rule variant 1
| Field | Type | Description |
|---|---|---|
type | "cellIs" | |
operator | "gt" | "gte" | "lt" | "lte" | "eq" | "neq" | "between" | |
value | number | string | |
value2? | number | string |
sheets[].conditionalFormats[].rule variant 2
| Field | Type | Description |
|---|---|---|
type | "formula" | |
formula | string |
sheets[].conditionalFormats[].rule variant 3
| Field | Type | Description |
|---|---|---|
type | "colorScale" | |
minColor | string | |
midColor? | string | |
maxColor | string |
sheets[].conditionalFormats[].rule variant 4
| Field | Type | Description |
|---|---|---|
type | "dataBar" | |
color | string |
sheets[].conditionalFormats[].rule variant 5
| Field | Type | Description |
|---|---|---|
type | "iconSet" | |
icons? | "3arrows" | "3trafficLights" | "3symbols" | "3flags" | "4arrows" | "4rating" | "5arrows" | "5rating" | |
reverse? | boolean | |
showValue? | boolean | Default true; false shows the icon only |
sheets[].conditionalFormats[].rule variant 6
| Field | Type | Description |
|---|---|---|
type | "top" | "bottom" | |
rank | integer (min 1, max 1,000) | |
percent? | boolean | rank is a percentage of the cells |
sheets[].conditionalFormats[].rule variant 7
| Field | Type | Description |
|---|---|---|
type | "aboveAverage" | |
below? | boolean |
sheets[].conditionalFormats[].rule variant 8
| Field | Type | Description |
|---|---|---|
type | "containsText" | |
text | string (max 255 chars) |
sheets[].conditionalFormats[].rule variant 9
| Field | Type | Description |
|---|---|---|
type | "duplicates" | |
unique? | boolean | Highlight values that appear once instead |
sheets[].conditionalFormats[].style
| Field | Type | Description |
|---|---|---|
bold? | boolean | |
fontColor? | string | |
fill? | string |
sheets[].validations[]
| Field | Type | Description |
|---|---|---|
range | string | A1 range on the same sheet, e.g. B2:B13 |
type | "list" | "whole" | "decimal" | "date" | "textLength" | |
values? | string[] (at most 255) | Allowed values for type=list |
source? | string (min 2 chars) | Range or defined name holding the allowed values for type=list |
min? | number | |
max? | number | |
promptTitle? | string (max 32 chars) | |
prompt? | string (max 255 chars) | Input message shown when the cell is selected |
errorTitle? | string (max 32 chars) | |
error? | string (max 255 chars) | |
errorStyle? | "stop" | "warning" | "information" | Default stop: a wrong value is refused |
sheets[].charts[]
| Field | Type | Description |
|---|---|---|
id? | string (max 64 chars) | |
type | "column" | "bar" | "line" | "area" | "pie" | "doughnut" | "scatter" | "waterfall" | waterfall: one series of changes, drawn as stacked columns (Excel's own waterfall type is not written) |
stacked? | boolean | "percent" | true stacks; "percent" stacks to 100% |
title? | string (max 255 chars) | |
anchor | string | Top-left cell the chart is placed at |
widthCols? | integer (min 2, max 40) | |
heightRows? | integer (min 5, max 80) | |
categories? | string (min 2 chars) | Category labels range, e.g. 'Sales 2026'!A2:A13 |
series | object[] (at least 1, at most 12) | |
yAxis? | object | |
y2Axis? | object | The secondary value axis |
totalLast? | boolean | waterfall: the last point is a total bar, not a change |
xAxis? | object | |
legend? | "bottom" | "right" | "top" | "none" | |
showValues? | boolean | A value label on every point. Default: on for column, bar and line charts with at most 8 points |
sheets[].charts[].series[]
| Field | Type | Description |
|---|---|---|
name? | string (max 255 chars) | |
values | string (min 2 chars) | Range or defined name holding the allowed values for type=list |
color? | string | |
type? | "column" | "line" | "area" | Combo chart: this series as columns, a line or an area |
secondaryAxis? | boolean | Plot on a second value axis on the right (combo charts) |
sheets[].charts[].yAxis
| Field | Type | Description |
|---|---|---|
title? | string (max 255 chars) | |
numFmt? | string (max 255 chars) |
sheets[].charts[].y2Axis
The secondary value axis
| Field | Type | Description |
|---|---|---|
title? | string (max 255 chars) | |
numFmt? | string (max 255 chars) |
sheets[].charts[].xAxis
| Field | Type | Description |
|---|---|---|
title? | string (max 255 chars) |
sheets[].sparklines[]
| Field | Type | Description |
|---|---|---|
at | string | Cell the sparkline is drawn in |
range | string (min 2 chars) | One row or column of values, e.g. B2:M2 |
type? | "line" | "column" | "winLoss" | |
color? | string | |
markers? | boolean | Line: a marker on every point |
highLow? | boolean | Mark the highest and lowest point |
sheets[].print
| Field | Type | Description |
|---|---|---|
repeatRows? | integer (min 1, max 50) | Top rows repeated on every printed page (the header) |
repeatCols? | integer (min 1, max 20) | Left columns repeated on every printed page |
fitWidth? | boolean | Fit all columns on one page width. Default: when they nearly fit |
landscape? | boolean | |
paper? | "A4" | "letter" | Default from the locale |
gridlines? | boolean | Print the gridlines |
centre? | boolean | Centre the sheet horizontally on the page. Default true |