Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

pyexcel export error "No content, file name. Nothing is given"

I'm using django-pyexcel to export data from the website, but when I go to the export URL I get the error:

Exception Type: IOError

Exception Value: No content, file name. Nothing is given

The code to export the data was copied from the example given in the documentation:

return excel.make_response_from_a_table(Question, 'xls', file_name="sheet")
like image 229
Tony Avatar asked Oct 17 '16 10:10

Tony


2 Answers

The problem turned out to be the file format used, xls in this case.

I had only installed the xlsx (pyexcel-xlsx) processor so it did not know how to handle the xls file format.

The exception message could have been a bit better as I spent ages trying to figure out if there was a problem with the filename I'd supplied.

like image 118
Tony Avatar answered Nov 13 '22 20:11

Tony


I had the same problem using Flask app. Try installing the following requirements:

numpy==1.21.0
openpyxl==3.0.7
pandas==1.3.0
pyexcel-xlsx==0.6.0
XlsxWriter==1.4.4
like image 39
Mehrnoosh Dadashi Avatar answered Nov 13 '22 18:11

Mehrnoosh Dadashi