Send stored dataframe to excel

Hello @slyfox,

There are a couple of ways to do this, here is one example via dash through a download button:

Here is a way that I use to write multiple sheets to one excel file:

        resp = io.BytesIO()

        with pd.ExcelWriter(resp, engine='xlsxwriter') as writer:
            data.to_excel(writer, sheet_name='data', index=False)
            data_calc.to_excel(writer, sheet_name='data2', index=False)
            costs.to_excel(writer, sheet_name='costs', index=False)
            if revenue is not None:
                revenue.to_excel(writer, sheet_name='revenue', index=False)

        return dcc.send_bytes(resp.getvalue(), 'data.xlsx')
1 Like