-
-
Notifications
You must be signed in to change notification settings - Fork 167
Index out of range in xls File with only 1 line (column name) #100
Copy link
Copy link
Closed
Labels
Description
I need to convert to dict a File opened from pyexcel, but these file, only have 1 line, with the columns name:
I use these code:
data_file = self.file
self._sheet = pyexcel.get_sheet(file_type=file_extension,
file_content=data_file.read(),
name_columns_by_row=0)
data_file.seek(0) # it is necessary to return file cursor after read
return self._sheet.to_dict()
File is a FieldFile, came from Form
I got these error on these line return self._sheet.to_dict() :
File "/Users/fellipeh/.virtualenvs/myproj/lib/python3.6/site-packages/pyexcel/sheet.py" in to_dict
413. for column in self.named_columns():
File "/Users/fellipeh/.virtualenvs/myproj/lib/python3.6/site-packages/pyexcel/sheet.py" in named_columns
430. yield {column_name: self.column[column_name]}
File "/Users/fellipeh/.virtualenvs/myproj/lib/python3.6/site-packages/pyexcel/internal/sheets/column.py" in __getitem__
223. return self._ref.named_column_at(aslice)
File "/Users/fellipeh/.virtualenvs/myproj/lib/python3.6/site-packages/pyexcel/sheet.py" in named_column_at
230. column_array = self.column_at(index)
File "/Users/fellipeh/.virtualenvs/maare/lib/python3.6/site-packages/pyexcel/internal/sheets/matrix.py" in column_at
185. raise IndexError(constants.MESSAGE_INDEX_OUT_OF_RANGE)
Exception Type: IndexError at /myfilefile/new/replace/
Exception Value: Index out of range
it's works on the past, but after update, start to get these issue...
Any thoughts?
Regards
Reactions are currently unavailable