Hello all,
So Iβm wondering is there any chance to change the date format in the picture to 14.03.2022.
This is my code for getting the excel sheet:
@app.callback(Output("link6", "children"),
             [Input("excel_data6", "data")],
            state=[State("start_date_picker", "date"),
            State("start_time_picker", "value"),
            State("end_date_picker", "date"),
            State("end_time_picker", "value"),
            State("database", "value")])
def download_sheet(output, start_date_picker, start_time_picker, end_date_picker, end_time_picker, database):
    if not output:
        return None
    df = pd.read_json(output, orient='split')
    df["Timestamp"] = df["Timestamp"].dt.tz_localize(None)
    start_time = datetime.datetime.strptime(start_date_picker, "%Y-%m-%d") + datetime.timedelta(hours=int(start_time_picker[0:2]))
    end_time = datetime.datetime.strptime(end_date_picker, "%Y-%m-%d") + datetime.timedelta(hours=int(end_time_picker[0:2]))
    xlsx_io = io.BytesIO()
    writer = pd.ExcelWriter(xlsx_io, engine='xlsxwriter', options={"remove_timezone" : True})
    df.to_excel(writer, sheet_name="Error Log")
    writer.save()
    xlsx_io.seek(0)
    # https://en.wikipedia.org/wiki/Data_URI_scheme
    media_type = 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'
    data = base64.b64encode(xlsx_io.read()).decode("utf-8")
    href_data_downloadable = f'data:{media_type};base64,{data}'
    file_name = "Parameter_Log-{0}-{1}_{2}.xlsx".format(str(database), start_time, end_time)
    return html.A("Download Excel Sheet", download=file_name, href=href_data_downloadable)
