Search code examples
python-3.xazureazure-functionsxlsxazure-http-trigger

Content-Disposition header Azure HTTP trigger function


Basically iam trying to get an excel as a response from an HTTP triggered azure function

response = func.HttpResponse(data, mimetype='application/vnd.ms-excel')
response['Content-Disposition'] = 'attachment; filename="test.xlsx"'
return response

but there is no header for Content -Disposition


Solution

  • Please try to use this code:

    response = func.HttpResponse(fileContent, headers={'Content-Disposition':'attachment; filename="test.xlsx"'}, mimetype='application/vnd.ms-excel')