pandas导出多页的excel

示例

output = BytesIO()
with pd.ExcelWriter(output) as w:
    df.to_excel(w, index=False, sheet_name='sht1')
    df2.to_excel(w, index=False, sheet_name='sht2')
output.seek(0)
response = HttpResponse()
response["Content-Type"] = "application/vnd.ms-excel"
response['Access-Control-Expose-Headers'] = 'Content-Disposition'
response['Content-Disposition'] = 'attachment;filename=result.xlsx'
response.write(output.getvalue())
output.close()
return response