Black Lives Matter. Please consider donating to Black Girls Code today.
Dash HoloViews is now available! Check out the docs.

Downloading datatable in CSV format

Hi everyone,
I have prepared a dashboard. Where I have a dash datatable.
df is the dataframe from excel file

                                                  columns=[{'id': c, 'name':c} for c in columns],
                                                  fixed_rows = {'headers': True},
                                                  style_cell={'width': '200px', 'textAlign': 'center'},
                                                  style_table={'overflowX': 'auto','overflowY':'auto','maxHeight': '400px','minwidth':'100%','font-family':'Calibri'},
                                                            'backgroundColor':  'rgb(52,98,145)',
                                                              html.Button('Save', id='save-button'),
                                                              html.P(id='editable-table-hidden', style={'display':'none'}),
                                                              html.P(id='save-button-hidden', style={'display':'none'}),
                                                         ], className='row')

And the callback is-

@app.callback(Output('save-button-hidden', 'children'),
                          [Input('save-button', 'n_clicks')])
def clicks(n_clicks):
    if n_clicks > 0:
        df.to_csv('df.csv', index=False, encoding='utf-8')

How to download the data from the table after using Filter.
I am using the above code but the data that is being downloaded is the df. I want the data that is in the datatable to be downloaded after applying the filter.

How to do the same ? Kinldy help.

have you tried the built in export feature of the table? search for export in


Dear Chris,

I have been able to do it. That was wonderful. Thank you so much !!

Is there a way to change the default export name of ‘Data’ ?

Dash export style color of csv datatable ?