Search code examples
pythondjangopyexceldjango-excel

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")

Solution

  • 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.