Код: Выделить всё
jsreport = filtered_report
if isinstance(jsreport, dict):
jsreport = [jsreport]
df = pd.DataFrame(jsreport)
# Generate the Excel file in memory
output = BytesIO()
with pd.ExcelWriter(output, engine='openpyxl') as writer:
df.to_excel(writer, index=False)
output.seek(0)
# Send the file to the user for download
return send_file(output, as_attachment=True, download_name=f"report_{month_year}.xlsx", mimetype='application/vnd.openxmlformats-officedocument.spreadsheetml.sheet')
Подробнее здесь: https://stackoverflow.com/questions/795 ... roportions