Reputation: 33
I am writing a program to fetch a bunch of data from the web then write it in an excel document. In the last step I am getting an error while trying to write the cells and I am not sure what the error means or what I could do to fix it.
The error looks like this:
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/xlwt/Worksheet.py", line 1030, in write
self.row(r).write(c, label, style)
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/xlwt/Row.py", line 235, in write
self.__adjust_bound_col_idx(col)
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/xlwt/Row.py", line 78, in __adjust_bound_col_idx
raise ValueError("column index (%r) not an int in range(256)" % arg)
ValueError: column index (256) not an int in range(256)
149-166-202-213:Peter peter$`
The error is supposedly on line 106, which is blank. It seems like I am trying to write to cells that are not within the range of the document, how could I extend the range of the excel document or change the way I'm writing to the cells to help?
BTW, the modules I'm using to access excel docs are here
Upvotes: 0
Views: 2092
Reputation: 102932
The maximum number of columns in a .xls
spreadsheet is 256 (according to Microsoft). If you go to the Excel 2010 format, that limit is increased to 16,384.
From some (rather brief) research, it looks like OpenPyXL might work for you. I can't find any hard-coded column limits in its code or docs, and unfortunately I don't have a version of Excel to test it for you, but it certainly looks promising.
Upvotes: 1
Reputation: 114098
you have too many columns it(an excel worksheet) only supports 256 columns and 65k ish rows
Upvotes: 0