---
title: "How to use actions to handle data"
description: "Trigger `export_data` from a button to download every graph, table, and figure on the current page, respecting active filters and dynamic-data parameters."
source_url: "https://vizro.readthedocs.io/en/stable/pages/user-guides/data-actions/"
agent_docs: "Index: https://vizro.readthedocs.io/en/stable/llms.txt; full documentation: https://vizro.readthedocs.io/en/stable/llms-full.txt"
---

# How to use actions to handle data

## Export data

To download data from your dashboard, you can use the [`export_data` action](https://vizro.readthedocs.io/en/stable/pages/API-reference/actions/#vizro.actions.export_data "            export_data


  
      pydantic-model
  "). For example, you can attach the action to a [button](https://vizro.readthedocs.io/en/stable/pages/user-guides/button/) as follows. When a user clicks the "Export data" button, all data on the page is downloaded.

Export data action

app.pyapp.yamlResult

```python
import vizro.actions as va
import vizro.models as vm
import vizro.plotly.express as px
from vizro import Vizro

df = px.data.iris()

page = vm.Page(
    title="Action triggered by a button",
    components=[
        vm.Graph(figure=px.histogram(df, x="sepal_length")),
        vm.Button(text="Export data", actions=va.export_data()),
    ],
    controls=[vm.Filter(column="species")],
)

dashboard = vm.Dashboard(pages=[page])
Vizro().build(dashboard).run()
```

```yaml
# Still requires a .py to add data to the data manager and parse YAML configuration
# See yaml_version example
pages:
  - components:
      - type: graph
        figure:
          _target_: histogram
          data_frame: iris
          x: sepal_length
      - type: button
        text: Export data
        actions:
          - type: export_data
    controls:
      - type: filter
        column: species
    title: Action triggered by a button
```

The dashboard renders the "Export data action" example.

[![ExportData](https://vizro.readthedocs.io/en/stable/assets/user_guides/actions/actions_export.gif)](https://vizro.readthedocs.io/en/stable/assets/user_guides/actions/actions_export.gif)

When you click the "Export data" button, the data for all graphs, tables and figures on the page is downloaded. In this example, this will produce a csv file for the graph's source data `px.data.iris()`.

Exported data includes the effect of [controls](https://vizro.readthedocs.io/en/stable/pages/user-guides/controls/) such as [filters](https://vizro.readthedocs.io/en/stable/pages/user-guides/filters/) and [dynamic data parameters](https://vizro.readthedocs.io/en/stable/pages/user-guides/parameters/#dynamic-data-parameters). Modifications from the chart, table or figure itself are not included (for example, AG Grid filters, graph zoom and data transformations performed inside a [custom chart functions](https://vizro.readthedocs.io/en/stable/pages/user-guides/custom-charts/)).
