> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://help.sigmacomputing.com/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://help.sigmacomputing.com/_mcp/server.

# Example representation: Workbook with an unnested array

> Example Sigma code representation of a workbook with an unnested array.

This is an example representation of a workbook, retrieved using the [Get a workbook](/reference/get-workbook) endpoint with the query parameter `includeContents=true`. Representations like this one can be used to create a workbook from code using the [Create a workbook](/reference/create-workbook) endpoint. Each page in this example library includes the code representation of the workbook and step-by-step instructions to create it in the Sigma UI.

Consult this example and others in the [Workbook representation example library](/docs/workbook-representation-example-library) to:

* Troubleshoot the formatting of a particular feature in code representation
* Relate a feature from the Sigma UI to its representation in code
* Provide context to AI tools used to create workbooks from code

> **Warning**
>
> This example representation cannot be used as-is. All identifying details, such as IDs, names, and URLs, have been replaced with randomized ID values or generic substitutions. The format of these contents, like the length of ID values, is preserved for demonstrative purposes. However, this representation cannot be directly used without modification to the base URL, connection details, and more. For more information, see [Create and manage workbooks from code](/docs/manage-workbooks-as-code).

## System and user requirements

To complete the steps in this example, you must meet the user requirements listed below for creating the workbook in the UI and creating it from code.

The ability to create this workbook in the Sigma UI requires the following:

* You must be assigned an [account type](/docs/account-type-and-license-overview) with the **Create input tables** and **Create, edit, and publish workbooks** permissions enabled.
* You must have **Can write only** or **Can use** data access on a connection with write access enabled.

The ability to create a workbook from code requires the following:

* You must be assigned an [account type](/docs/account-type-and-license-overview) with the **Create, edit, and publish workbooks** permission enabled.
* You must have developer credentials for the Sigma API. For more information, see [Get started with the Sigma REST API](/reference/get-started-sigma-api).

## Create the example workbook in the Sigma UI

This example shows a workbook with an input table containing an array and a table that unnests the array into rows.

To create this workbook in the Sigma UI:

1. Go to the **Home** page.
2. Select **Create new** > **Workbook**.
3. From the **Add element** bar, select **Input** > **Empty input table**.
4. In the **Select connection** dropdown, select a connection with write access, then select **Create table**.
5. In the input table, create a calculated column named `Array` with the formula `Array(1, 2, 3)`.
6. From the **Add element** bar, select **Table** > **Data** > **Unnest**.
7. In the **Select source** modal, select the input table, then click **Select**.
8. In the **Unnest table** modal, select *Array* as the **Array column** and enter `Values` as the **Values column label**.
9. Turn on the **Include index column** toggle and enter `Indices of Array` as the **Index column label**.
10. Under **Output columns**, select *Values* and *Indices of Array*, then select **Submit**.
11. In the document header, select **Save as**.
12. Enter a name for the workbook, such as `unnest`.
13. Select **Save**.

## Get a code representation of this workbook

To get a representation of this workbook, follow the steps in [Get the code representation of a workbook](/docs/get-the-code-representation-of-a-workbook).

The code representation of this workbook appears like the following:

#### YAML representation

```yaml
workbookId: 4dad2986-ce83-4960-aa06-e9ab85a0bcc1
workbookUrlId: 9xslXTTIQrh6bpy0VAq3GZ
createdBy: uO2R8UziJdi0Y4mj4TIJZ9RnvIh4T
updatedBy: uO2R8UziJdi0Y4mj4TIJZ9RnvIh4T
createdAt: '2026-11-03T20:24:54.585Z'
updatedAt: '2026-11-03T20:28:47.401Z'
name: unnest
url: https://aws-api.sigmacomputing.com/org-name/workbook/9xslXTTIQrh6bpy0VAq3GZ
path: My Documents/<folder-name>
latestVersion: 2
ownerId: uO2R8UziJdi0Y4mj4TIJZ9RnvIh4T
isArchived: false
contents:
  schemaVersion: 1
  elements:
    - id: OetAfG82EO
      kind: input-table
      source:
        kind: empty
        connectionId: aebf9993-2440-4d96-9995-d8aaff0f3b81
      inputMode: edit
      columns:
        - id: ZA0G6vbBxK
          formula: Array(1, 2, 3)
          name: Array
    - id: d5WVwd9ExL
      kind: table
      source:
        kind: unnest
        source:
          elementId: OetAfG82EO
          kind: table
        arrayColumn: Array
        valueColumn: Values
        outputColumns:
          - Values
          - Indices of Array
        indexColumn: Indices of Array
        preserveAllSourceRows: disabled
      columns:
        - id: Xa3zphJn9p
          formula: '[Unnest of New Input Table/Values]'
        - id: H9xdreYrmV
          formula: '[Unnest of New Input Table/Indices of Array]'
      order:
        - Xa3zphJn9p
        - H9xdreYrmV
  pages:
    - id: M1JIJ5iqQt
      name: Page 1
  kind: workbook
  layout: |
    <?xml version="1.0" encoding="utf-8"?>
    <Page type="grid" gridTemplateColumns="repeat(24, 1fr)" gridTemplateRows="auto" id="M1JIJ5iqQt">
      <Element elementId="OetAfG82EO" gridColumn="1 / 25" gridRow="1 / 21"/>
      <Element elementId="d5WVwd9ExL" gridColumn="1 / 25" gridRow="21 / 41"/>
    </Page>
documentVersion: 2

```

## Representing an unnested array

#### Unnested array representation

```yaml
...
id: d5WVwd9ExL
kind: table
source:
  kind: unnest
  source:
    elementId: OetAfG82EO
    kind: table
  arrayColumn: Array
  valueColumn: Values
  outputColumns:
  - Values
  - Indices of Array
  indexColumn: Indices of Array
  preserveAllSourceRows: disabled
columns:
- id: Xa3zphJn9p
  formula: '[Unnest of New Input Table/Values]'
- id: H9xdreYrmV
  formula: '[Unnest of New Input Table/Indices of Array]'
order:
- Xa3zphJn9p
- H9xdreYrmV
...
```

## Related resources

* [Manage workbooks as code](/docs/manage-workbooks-as-code)
* [Create a table from an array](/docs/create-a-table-from-an-array)