> For the complete documentation index, see [llms.txt](https://docs.avonnicomponents.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.avonnicomponents.com/flow/tutorials/components/data-table/setting-up-data-export.md).

# Setting up data export

Add an Export button to a screen flow Data Table so users download the deals they see, the rows they selected, or everything, as Excel or CSV.

A sales manager reviews the pipeline in a screen flow and wants to send the late-stage deals to finance as a spreadsheet. An **Export** button in the table header downloads the rows as an Excel or CSV file, with no report to build.

Export is an interaction: you add a button to the table, then tell the button to run **Export To**.

<figure><img src="https://27923732-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F1FUd4apB9YHgCEMUFbVb%2Fuploads%2F27pwsl9p9uS4LsoBckRp%2Fdata-table-tutorial-setting-up-data-export-result.png?alt=media" alt="Export dialog opened from the Data Table header"><figcaption><p>The Export dialog opens with the defaults set on the interaction.</p></figcaption></figure>

## Before you start

* A screen flow with an Avonni Data Table listing Opportunities. See [Learn the Basics](https://docs.avonnicomponents.com/flow/tutorials/components/data-table/learn-the-basics.md).
* Optional: row selection turned on, if users should export only the rows they tick. See [Work with Selected Rows](https://docs.avonnicomponents.com/flow/tutorials/components/data-table/work-with-selected-rows.md).

## Steps

{% stepper %}
{% step %}

### Add an Export button to the header

1. Select the Data Table on the screen and click **Open Component Builder**.
2. In the **Properties** tab, open the **Header** group and add an item under **Actions**.
3. Set **Label** to `Export`, **Name** to `export` and, optionally, **Icon Name** to `utility:download`.

The button appears in the table header. [Enabling auto-refresh](https://docs.avonnicomponents.com/flow/tutorials/components/data-table/tips-and-tricks/enabling-auto-refresh-on-the-data-table-when-pressing-a-button.md) adds a Refresh button the same way.
{% endstep %}

{% step %}

### Attach the Export To interaction

1. Open the **Interactions** tab and add an interaction under **Header Action**.
2. In **Target Name**, pick **Export** (the list shows the button labels).
3. Set **Type** to **Export To**.

<figure><img src="https://27923732-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F1FUd4apB9YHgCEMUFbVb%2Fuploads%2FcJk8OTVQgGrX4Xd2IdRb%2Fdata-table-tutorial-setting-up-data-export-interaction.png?alt=media" alt="Export To interaction settings under Header Action" width="320"><figcaption><p>Export To sits on the header button's interaction.</p></figcaption></figure>
{% endstep %}

{% step %}

### Set the export defaults

| Setting                    | What it does                                                                                                                |
| -------------------------- | --------------------------------------------------------------------------------------------------------------------------- |
| **Default File Name**      | The file name offered to the user, for example `Pipeline review`. Map it to a flow resource to build the name from data.    |
| **Available File Formats** | **CSV**, **Excel**, or both.                                                                                                |
| **Default Encoding Type**  | The character set of the file. Keep **Unicode (UTF-8)** unless the file opens with broken accents in your spreadsheet tool. |
| **Export All Data**        | Exports every record of the table, not just the rows on screen, up to 50,000 records.                                       |
| **Hide Export Dialog**     | Skips the dialog and downloads at once with the defaults above.                                                             |
| {% endstep %}              |                                                                                                                             |

{% step %}

### Know which rows leave the table

| The user...          | **Export All Data** off      | **Export All Data** on |
| -------------------- | ---------------------------- | ---------------------- |
| has selected rows    | The selected rows.           | Every record.          |
| has selected nothing | The rows shown in the table. | Every record.          |

Only visible columns are exported: a column you hid with **Hidden** stays out of the file. To add fields that are not columns, such as the record Id for a reimport, list them in **Properties** > **Data Mappings** > **Export To Fields**. They are added after the visible columns.
{% endstep %}

{% step %}

### Save and test

Run the flow in debug and click **Export**. The **Export** dialog opens with **File Name**, **Export View** (**Formatted Report** or **Details Only**), the **Export all data** toggle and **Format** (default **Excel Format .xlsx**). **Encoding Type** appears only when the user picks **Comma Delimited .csv**. Click **Export**: the browser downloads the file.
{% endstep %}
{% endstepper %}

{% hint style="info" %}
The **Export all data** toggle in the dialog starts in the state of **Export All Data** on the interaction. If users keep having to tick it, turn **Export All Data** on. Turn **Hide Export Dialog** on as well and the button exports everything in one click. Both settings belong to that one interaction, so set them on each table that exports.
{% endhint %}

## Troubleshooting

<details>

<summary><strong>The export contains only the first rows</strong></summary>

**Export All Data** is off and nothing was selected, so the export takes the rows shown in the table. Turn **Export All Data** on, or ask users to tick it in the dialog.

</details>

<details>

<summary><strong>A column is missing from the file</strong></summary>

The column is hidden. Hidden columns are never exported. Add the field to **Export To Fields** instead.

</details>

## Related tutorials

* [Creating Row Actions](https://docs.avonnicomponents.com/flow/tutorials/components/data-table/creating-row-actions.md): put the same interaction on a row menu.
* [Work with Selected Rows](https://docs.avonnicomponents.com/flow/tutorials/components/data-table/work-with-selected-rows.md): let users pick the rows to export.
* [Data Table reference](https://docs.avonnicomponents.com/flow/flow-components/data-table.md): every interaction type of the table.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.avonnicomponents.com/flow/tutorials/components/data-table/setting-up-data-export.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
