> 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/dynamic-components/tutorials/components/data-table/enable-data-export.md).

# Enable Data Export

An Export button on the Data Table downloads the rows users see, or only the ones they ticked, as an Excel or CSV file for their own spreadsheet.

A sales manager prepares the weekly forecast meeting in a spreadsheet. Instead of rebuilding a report, they filter the pipeline table, tick the deals that matter, and click **Export**. The file lands in their downloads with the columns they saw on screen.

<figure><img src="https://2532358799-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FODPvvv7Cx9Z9RECLn3oV%2Fuploads%2FrlNtBzj41FgjMZzadb06%2Fdata-table-tutorial-enable-data-export-result.png?alt=media" alt="Pipeline table with an Export button and two selected rows"><figcaption><p>Ticked rows are the ones exported.</p></figcaption></figure>

## Before you start

* A Data Table with a **Query** data source. See [Data Table](https://docs.avonnicomponents.com/dynamic-components/components/data-table.md). **Export To Fields** and the export of every record need a query.
* An Export button in the table header, or any other trigger. The steps below create the header button.

## Steps

{% stepper %}
{% step %}

### Add an Export button to the header

1. Select the Data Table and stay on the **Properties** tab.
2. In the **Header** section, add an item to **Actions**: **Label** `Export`, **Name** `export`, **Icon Name** `utility:download`.

[Configure Header Actions](https://docs.avonnicomponents.com/dynamic-components/tutorials/components/data-table/configure-header-actions.md) covers header buttons in detail.
{% endstep %}

{% step %}

### Add the Export To interaction

1. Open the **Interactions** tab and add an interaction under **Header Action Click**.
2. **Target Name**: **Export**. The list shows each action by its label.
3. **Type**: **Export To**.
   {% endstep %}

{% step %}

### Set the export defaults

These values pre-fill the export dialog. Users can still change them, unless you hide the dialog.

* **Default File Name**: for example `Pipeline`. You can also bind it to a resource, such as a text variable. Left empty, the file is named after the object.
* **Default Export View**: **Formatted Report** exports values as the table shows them (currency symbols, formatted dates). **Details Only** exports raw values, better for a re-import.
* **Available File Formats**: **CSV**, **Excel**, or both.
* **Default Encoding Type**: **Unicode (UTF-8)** suits most tools. It applies to CSV files.
* **Export All Data**: see the next step.
* **Hide Export Dialog**: the file downloads at once with the defaults above. With both formats available, the file is Excel; keep only **CSV** to get a CSV.

<figure><img src="https://2532358799-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FODPvvv7Cx9Z9RECLn3oV%2Fuploads%2FVKXToWS1KLtqzwmT5ajA%2Fdata-table-tutorial-enable-data-export-interaction.png?alt=media" alt="Export To interaction settings" width="320"><figcaption><p>These defaults pre-fill the export dialog.</p></figcaption></figure>
{% endstep %}

{% step %}

### Decide which rows are exported

* Users who tick rows export only those rows.
* With no row ticked, the export covers the rows loaded in the table.
* The dialog has an **Export all data** toggle. It matters when the query returns more rows than the table has loaded: on, the file holds every record of the query, up to 50,000. **Export All Data** on the interaction turns it on by default.

<figure><img src="https://2532358799-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FODPvvv7Cx9Z9RECLn3oV%2Fuploads%2FEcN91Hb9B6UgZ3VLsiKM%2Fdata-table-tutorial-enable-data-export-dialog.png?alt=media" alt="Export dialog with file name, export view, export all data and format" width="480"><figcaption><p>Users confirm or change the defaults before the file downloads.</p></figcaption></figure>
{% endstep %}

{% step %}

### Add fields that are not on screen

Hidden columns are never exported. To include fields users do not need to see, such as record Ids for a re-import, pick them in **Export To Fields** in the **Data Mappings** section (next to **Sort By** and **Group By**). They are added after the visible columns.
{% endstep %}

{% step %}

### Save and test

Save the component and open the page where it is placed. Tick two rows and click **Export**: the **Export** dialog opens with your file name, format and encoding. Click **Export** in the dialog: the file contains the two rows, with one column per visible column plus the **Export To Fields**.
{% endstep %}
{% endstepper %}

## Troubleshooting

<details>

<summary>Export does nothing on a table with buttons or a row action menu</summary>

A known issue: when the query returns more rows than the table has loaded, and the table has a **Button**, **Button Icon** or **Action** column, the click produces no file. Turning on **Export All Data** does not get around it. Until a fix ships, if the list stays under 500 records, raise **Number of Items per Page** (**Pagination** section) above the record count, so every row is loaded before the export.

</details>

<details>

<summary>Users must tick "Export all data" every time</summary>

Turn on **Export All Data** on the Export To interaction: the toggle arrives already on. Add **Hide Export Dialog** to skip the dialog. Both are set per interaction, so repeat them on each table.

</details>

<details>

<summary>A field I hid on purpose is missing from the file</summary>

Hidden columns are left out of the export. Add the field to **Export To Fields** instead of keeping it as a hidden column.

</details>

<details>

<summary>CSV does nothing in production, Excel works</summary>

Older package versions build the CSV download in a way that Lightning Web Security blocks in some orgs. Update the package to the latest version. Until then, offer **Excel** in **Available File Formats**.

</details>

## Related tutorials

* [Configure Header Actions](https://docs.avonnicomponents.com/dynamic-components/tutorials/components/data-table/configure-header-actions.md): more buttons next to Export.
* [Open a Record from a Row](https://docs.avonnicomponents.com/dynamic-components/tutorials/components/data-table/open-a-record-from-a-row.md): how pagination and progressive loading decide which rows are loaded.
* [Export To](https://docs.avonnicomponents.com/dynamic-components/component-builder/interactions/export-to.md): the interaction reference.


---

# 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/dynamic-components/tutorials/components/data-table/enable-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.
