Adding extra information to datatable before exporting to xlsx

Hello everyone,

I have the following situation:

My dashboard performs some data processing based on multiple input parameters. The output is a datatable.

I want my users to be able to download the resulting datatable as xlsx. Nothing special so far. But…

I would like to attach some extra information to the excel file. E.g. a timestamp and values of the input parameters.

Is there a simple way to do that? I haven’t found any information on that. Is it at least possible to define a name other than ‘Data.xlsx’ for the excel file?

I can imagine having some hidden columns in the datatable where I would store all the other information but it does not feel like an elegant solution. Any advice?

I imagine you are using the export button from dash_table.DataTable, right? If so, then there is an open issue to allow to change the name of the output file.

One option that could allow you more flexibility is the Downloadcomponent from dash-extensions. I believe there you could in principle add an extra sheet with the data you want, or simply customize the filename.

1 Like