# GT.as_gridwell()

Output a GT object as gridwell IR.

Usage

[Source](https://github.com/posit-dev/great-tables/blob/main/great_tables/_gridwell.py#L59-L105)

``` python
GT.as_gridwell()
```

The [as_gridwell()](../reference/GT.as_gridwell.md#great_tables.GT.as_gridwell) method outputs a GT object as the IR of [gridwell](https://github.com/rich-iannone/gridwell), a JSON document that gridwell renders to HTML, LaTeX, Typst, RTF, SVG, Word, Excel, PowerPoint and other formats. The IR is IR 1.0, and the same table always gives the same JSON. Great Tables doesn't need gridwell to write it.

> **Warning**
>
> [as_gridwell()](../reference/GT.as_gridwell.md#great_tables.GT.as_gridwell) is still experimental, until gridwell's IR 1.0 is frozen.

## Returns

`str`  
The table's gridwell IR, as a JSON string.

## Examples

The IR is a JSON string. Here it's read back with `json.loads()`, to see the parts of the table it describes, and the header's title.

``` python
import json
from great_tables import GT, exibble

gt_tbl = GT(exibble[["num", "char"]].head(3)).tab_header(title="A small table")

ir = json.loads(gt_tbl.as_gridwell())

list(ir), ir["header"]["title"]
```

    (['ir_version',
      'config',
      'styles',
      'header',
      'column_spec',
      'table',
      'footer',
      'extensions'],
     {'content': [{'type': 'text', 'value': 'A small table'}], 'style_id': None})

gridwell reads the IR and renders it (here, as Typst). To save a table to one of gridwell's formats in one step, use [`gtsave()`](../reference/GT.gtsave.md#great_tables.GT.gtsave) with that format's file extension.

``` python
from great_tables import GT, exibble
import gridwell

ir = GT(exibble).as_gridwell()
gridwell.parse_ir(ir).render_typst()
```
