Tables
A table has named columns and any number of rows. You can type one directly or load one from a CSV or JSON file.
Creating tables
A table starts with |Columns|, then its rows.
A short table can stay on one line:
If the data contains spaces, add quotes around it:
Item Quantity Price
Gift card 2 10.0
Rows, columns, and cells
Use .column to access a column:
[12.50 18.25 4.75 7.00 31.40]
Use .index to access a row, starting from zero:
{Name = "Alice" Age = 30}
Dot . can continue to chain:
"Alice"
a..b selects a range of rows. Either side can be omitted to expand the selection:
Category Item Amount
Food Lunch 12.50 Travel Train 18.25
Category Item Amount
Tools Notebook 7.00 Travel Taxi 31.40
Table types
Each column has a type, such as integer, decimal, or email. type-of displays the table's type:
:|Category = string Item = string Amount = decimal|
A type starts with a : prefix. Add a type before a column name when you want to set the type explicitly:
Name Amount
Lunch 12.50 Train 18.25
A typed header with no rows creates an empty table:
:|Name = string Age = int|
A row that does not fit its header, because it has the wrong number of cells or a cell of the wrong type, is set aside with a warning. The other rows still make the table, so one typo never breaks every page that uses it. An unannotated column takes its type from the first row that fits.
2
Optional columns
An optional column may contain a missing value. Write it as _ in a literal table. _ is short for null. An optional type has a ? suffix.
:|Name = string Age = int?|
or-else supplies a fallback value:
Name Age
Alice 0 Bob 25 Cara 25
A missing value is neither less nor greater than anything, so <, <=, > and >= with a null on either side are false and a filter leaves the row out. == and != see null as a value, and sort places it first.
Name Age
Bob 25 Cara 25
Name Age
Alice
Building from records
table.of turns a list of records into a table:
Plan Seats
Free 1
Team 25
Formatting columns
A format changes how a value displays without changing the value itself. Decorate a column in the table header with |>. Drag select the table to reveal its source:
Item Cost Done
Lunch $12.50 ✓ Train $18.25 —
Item Cost Done
Lunch $12.50 ✓
Date, time, and timestamp formats take a pattern. Date fields are y, yy, yyyy, M through MMMM, d, dd, and EEE, EEEE for the weekday name; clock fields are H, HH (24-hour), h, hh (12-hour), m, mm, s, ss, and a (AM/PM). A timestamp format displays in the reader's time zone, while drag select shows its value in UTC timezone:
Event At
Deploy Aug 2, 14:30 Review Aug 3, 09:05
A format also applies inside a select, and naming a decorator lets columns share one treatment:
Name Ratio
Alice 62.5% Bob 90.0%
See std/format.ki for the full set — percent, number, decimal, signed-number, compact, money, date, time, timestamp, and check.
A format works on a single value as well, in prose and inside text. A name keeps the format of its definition, so write the format once where the value is made:
Spent $1,234.50 so far; the receipt says "paid $1,234.50".
A control decorates a column the same way. A column wearing a choice lists what its cells may be, and a cell outside the list is flagged where it sits while its row stands:
Title Stage
Launch Draft Recap Idea
A format and a control stack: the format says how the value rests, the control how it is edited. A boolean column gets its toggle from its type; plain keeps a boolean as the words true and false. The source keeps the exact value, 0.625 and not 62.5%:
Task Progress Due Done Flag
Launch 63% Aug 14 true false Recap 25% Sep 30 false true
Keys
When rows are referred to from elsewhere, give the table a key column. key is a column decorator, written in the header like a format or a control:
Id Child Age
b2 Bob 3
The key is ordinary text, so it survives copying, exporting and rewriting, and another table or a page can name a row by it. Two rows with the same key are both kept and both flagged. A row added with table.insert may leave a string key out, and insert fills it with a fresh key: eight characters drawn from the host's randomness, so two people adding rows at the same time never collide. table.new-key makes the same kind of key where a program needs one in hand.
Labels
When a column's identifier is not the words a reader should see, give it a label. label is a column decorator like a format: the reading view, the grid and a printed table show the label, while code, select and lookups keep the identifier.
Company Last contact
Acme 2026-07-12
Owners
When different people own different rows, say which column holds the owner. owner is a column decorator like key, and the cell holds the owner's account email:
Id Title Author
n1 Hello ada@example.com n2 Again bob@example.com
The decorator names the column; the workspace's access settings decide who may see or change only their own rows. A table has one owner column.
Editing table rows
table.insert, table.delete, and table.update create tasks to update the table. The tasks only run with an explicit trigger, normally by clicking the button.
table.selection reads the rows currently selected. A row is considered selected as long as the selection range touches it:
A row may give a plain value for an optional column, and its own key for a key column, such as one key shared by a record and its lines:
Id Child Minutes
v1 Ada
These operations remember which source rows a query came from. Deleting or updating a filtered view is safe even when two rows look alike.
A shown table stays editable through filter, sort, select and lookup: typing in a cell changes that row of the table it came from, so a page can show only the rows to fill in, such as one stock count's items, and people type the values straight into it. A column computed in select, a column lookup brings across, and the rows of group or aggregate are results, not stored values, and do not edit.
A button inside select gives every row its own action, reading that row's values. Put it under a conditional to decide row by row: where an arm is text, the row shows that text instead of a button.
Name Age Status
Alice 30 adult Bob 16 Make 18 Cara 30 adult Dan 17 Make 18
Board view
A string column decorated with choice edits as a select over a fixed option set. Piping the table through view.board presents it as a kanban grouped by that column — one lane per option, one card per row. Dragging a card between lanes edits that row's cell, exactly like picking a new value in the select:
Task Status Owner
Design Doing Maya Build Todo Theo
Apply view.board last: the value stays the ordinary table, so filters and aggregates read it unchanged.
Calendar view
view.calendar plots a table on a month grid by a date column — one card per row, on the day its date names. Dragging a card to another day edits that row's cell; a row with an empty date waits in the Unscheduled tray until a drag gives it one:
Title Publish
Launch note Aug 12 Field guide Aug 21
Like the board, the value stays the ordinary table.
Reading files
read-table loads a CSV or JSON file from the workspace. Without a type the table shows whole, and the read names the columns it found in the file.
Name Age
Alice 30 Bob 25
To use a column, write the columns before the read; the read then gives exactly that table. The command editor.use-file-columns writes the ones the read found.
:|Name = string Age = int|
A column whose name has a space, as many exported files have, is written in backticks, in a type and in a query alike.
Net Qty
4.50 2 5.00 1
A line of a CSV file that does not fit the table — too few or too many cells, or a cell that does not read as its column's type — is set aside with a warning naming the line, and the rest of the file still reads. A file without a column the type names fails the read.
File reads are live: when the file changes, calculations that use the table update automatically.
Writing files
io.write-table creates a file-writing task:
Where next
• doc/query.ki — filter, transform, and summarize tables