create_block
Create a structured table on a spreadsheet with typed columns, a read-only row key, and optional initial rows, enabling formula references via block names.
Instructions
Create a structured block (table) on a sheet. fields[0] is the row-key column (always read-only). Block ref name (name) is used as the first arg to BLOCKREF/BLOCKREFS in formulas.
Field types supported:
'string' / 'number' — plain text/numeric cells.
'boolean' — cell stores 0/1 or TRUE/FALSE; UI renders ✅/❌ if host has the widget set.
'enum' (+ enum_id) — cell stores variant id; UI renders dropdown if host has the widget set. Watson auto-injects a variant-whitelist validation formula on the field so out-of-set writes light up as warnings even without widget rendering. Requires a prior define_enum_set call with matching id.
Rules (value_formula / validation / editability) are set separately via set_field_rule — this call only declares structure + initial rows. Auto-creates the target sheet if missing.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| name | Yes | Block ref name. Used as the first arg to BLOCKREF/BLOCKREFS in formulas. Must be unique within the workbook. | |
| sheet | Yes | Target sheet name. | |
| fields | Yes | Column definitions in order. fields[0] is the row-key column. | |
| position | Yes | Top-left cell of the block (0-indexed). | |
| description | No | What this table is for, in a sentence or two: what a row represents, what the fields mean where the names are not obvious, and anything a later reader must not do to it (e.g. a field the craft maintains). Saved with the block and returned by describe_block, so write it for whoever opens the file next rather than for this conversation. | |
| initial_rows | No | Optional initial rows. |