Skip to main content

Table Data

The table block contains the actual table data, split into thead and tbody.

Structure

{
  "table": {
    "thead": { "rows": [...] },
    "tbody": [
      { "rows": [...] },
      { "rows": [...] }
    ]
  }
}
Field Type Default Description
thead TableHead required The column labels
tbody array of RowGroup required The body, as row groups (below)

thead

{
  "thead": {
    "rows": [{
      "role": "column_label",
      "style_id": null,
      "cells": [{
        "content": [{ "type": "text", "value": "Name" }],
        "colspan": 1, "rowspan": 1,
        "style_id": null,
        "is_stub": false, "is_placeholder": false,
        "scope": "col"
      }]
    }]
  }
}
Field Type Default Description
rows array of Row required config.header_rows rows: spanner labels above the column labels

tbody (Row Groups)

The body is an array of row groups. Each group has an optional label, data rows, and optional summary rows. A table without groups puts its rows in one group with no label.

{
  "tbody": [{
    "group_id": "grp_1",
    "label": {
      "content": [{ "type": "text", "value": "North America" }],
      "style_id": null
    },
    "rows": [{ "role": null, "cells": [...] }],
    "summary_rows": []
  }]
}
Field Type Default Description
group_id string? null The group’s id; HTML makes element ids from it (else from the label)
label GroupLabel? null A line above the group’s rows, across the table
rows array of Row required The data rows
summary_rows array of Row [] Summary rows (they need a stub column, SUMMARY_REQUIRES_STUB)
summary_placement keyword "bottom" Where the summary rows go: "bottom", after the data rows, or "top", before them (as gt’s and Great Tables’ side = "top")

Group labels

Field Type Default Description
content array of content nodes required The label
style_id string? null The label’s style
colspan integer? null Kept for producers, but not read: a group label always spans the whole (visible) table

Row Fields

Field Type Default Description
cells array of Cell required Exactly config.table_cols cells, placeholders included
role keyword? null "column_label" or "spanner_label" in thead; "summary_row" or "grand_summary_row" in a group’s summary_rows; null for a data row
style_id string? null A style for the whole row

Cell Fields

Field Type Default Description
content array of content nodes [] What the cell shows (empty for a placeholder)
typed_value TypedValue? null The value behind the display (below)
colspan integer 1 Columns the cell spans (≥ 1)
rowspan integer 1 Rows the cell spans (≥ 1), within its section
style_id string? null The cell’s style
is_stub boolean false The cell is a row label, in a stub column
is_placeholder boolean false The cell is a position another cell spans (below)
scope keyword? null HTML: what a header cell labels, "col", "row", "colgroup" or "rowgroup"

Typed Values

typed_value is the value behind a cell’s display, {"type": …, "value": …}.

Field Type Default Description
type keyword required "string", "number", "integer", "boolean", "date", "datetime", "time" or "duration" (aliases in Keyword values)
value any required The value

Each type’s value is written as below. A missing value (NA, None, NaN) has no typed_value: the cell leaves it out, and content shows what the producer shows for it.

type value
string a JSON string
number, integer a JSON number
boolean true or false
date an ISO 8601 date string: "2024-03-15"
datetime "2024-03-15T14:30:00" (or a space for the T; seconds and their fraction optional; no offset)
time "14:30:00" (seconds and their fraction optional)
duration an ISO 8601 duration string: "PT1H30M", "P2DT12H", "PT0.5S", "-P1Y"

A string value that isn’t a JSON string, or a duration value that isn’t an ISO 8601 duration string, is an INVALID_TYPED_VALUE error. A duration is P, then years, months, weeks and days (nY, nM, nW, nD), then T and hours, minutes and seconds (nH, nM, nS), each part optional but in that order, at least one in all and at least one after a T. Only the seconds may have a fraction (with a .), and a - before the P makes it negative.

Writers that keep values (XLSX) read the value as the cell’s: a number, a boolean, or a date, date-time or time, as a spreadsheet does. The value is what the cell holds; content is still what it shows. A string, a duration, and a value in another form are kept as text.

{ "content": [{"type": "text", "value": "Mar 15, 2024"}],
  "typed_value": {"type": "date", "value": "2024-03-15"} }

Spans and Placeholders

Cells with colspan or rowspan > 1 span multiple positions. Spanned-over positions must contain placeholder cells:

[
  { "content": [{"type": "text", "value": "Wide"}], "colspan": 2 },
  { "content": [], "is_placeholder": true }
]
Warning

Placeholder cells must have empty content. The validator rejects non-empty placeholders.