问题描述
基本上,我试图从 HTTP 触发的 azure 函数中获取 excel 作为响应
response = func.HttpResponse(data,mimetype='application/vnd.ms-excel')
response['Content-disposition'] = 'attachment; filename="test.xlsx"'
return response
解决方法
请尝试使用此代码:
response = func.HttpResponse(fileContent,headers={'Content-Disposition':'attachment; filename="test.xlsx"'},mimetype='application/vnd.ms-excel')