Soerendip
Soerendip

Reputation: 9148

How to change filename of exported dash datatable?

When using plotly/dash datatable it is possible to have an export button. However, the filename is always the same 'Data.csv' which is not very specific.

I would like to change that name dynamically, but I have not found any documentation about it. Here is how I instantiate the table:

from dash_table import DataTable

DataTable(
                id='the-great-table',
                columns=columns,
                data=None,
                sort_action="native",
                sort_mode="single",
                row_selectable=False,
                row_deletable=True,
                editable=True,
                column_selectable=False,
                selected_rows=[],
                page_action="native",
                page_current= 0,
                page_size= 30,
                filter_action='native',                
                style_table={'overflowX': 'scroll'},
                style_as_list_view=True,
                style_cell={'padding-left': '20px', 
                            'padding-right': '20px'},
                style_header={'backgroundColor': 'white',
                              'fontWeight': 'bold'},
                export_format='csv',
                export_headers='display',
                merge_duplicate_headers=True
            ) 

Upvotes: 5

Views: 2390

Answers (1)

WLiu
WLiu

Reputation: 486

Someone has requested this new feature and it is not support to change filename of exported dash datatable currently. The attached URL for your information.

https://github.com/plotly/dash-table/issues/636

Upvotes: 5

Related Questions