我正在尝试通过 Flask 的“send_file”方法发送工作簿文件。当我将文件保存到某个目录然后从那里发送时,它工作得很好。整个噱头就是这样做,而不实际将文件保存到目录。我已经尝试使用“send_file”、“send_from_directory”并使用 BytesIO 发送该文件:
myWorkbook = io.BytesIO()
wb.save(myWorkbook)
return send_file(
myWorkbookFile,
mimetype='application/vnd.ms-excel',
as_attachment=True,
download_name='testexcel.xlsx')
提前致谢