Opening spreadsheet returns InMemoryUploadedFile
- by David542
I have a user uploading a file to a website and I need to parse the spreadsheet. Here is my code:
input_file = request.FILES.get('file-upload')
wb = xlrd.open_workbook(input_file)
The error I keep getting is:
TypeError at /upload_spreadsheet/
coercing to Unicode: need string or buffer, InMemoryUploadedFile found
Why is this happening and what do I need to do to fix it? Thank you.
For reference, this is how I open the file in the shell
>>> import xlrd
>>> xlrd.open_workbook('/Users/me/dave_example.xls')
<xlrd.Book object at 0x10d9f7390>