Hi,
I'm sure this has been asked before, but I'm using xlrd 0.9.2 (that I installed using easy_install) along with Python 2.7.3. I'm trying to read a .xlsx file, and I get the error as shown in the traceback below:
Traceback (most recent call last):
File "C:\Users\pprao\Python_files\readXL.py", line 175, in <module>
book = xlrd.open_workbook("master_spreadsheet.xlsx")
File "C:\Python27\lib\site-packages\xlrd\__init__.py", line 429, in open_workbook
biff_version = bk.getbof(XL_WORKBOOK_GLOBALS)
File "C:\Python27\lib\site-packages\xlrd\__init__.py", line 1545, in getbof
bof_error('Expected BOF record; found %r' % self.mem[savpos:savpos+8])
File "C:\Python27\lib\site-packages\xlrd\__init__.py", line 1539, in bof_error
raise XLRDError('Unsupported format, or corrupt file: ' + msg)
xlrd.biffh.XLRDError: Unsupported format, or corrupt file: Expected BOF record; found 'PK\x03\x04\x14\x00\x06\x00'
The strange part is that I've managed to read this file on a Windows 7 machine with Excel 2007 with no issues whatsoever. When I try to read the same file on a different machine (Windows 8, with Excel 2010, product version attached), I get the above error. I'd really like to know more about the following:
- Why does this error occur on only one machine (with Excel 2010 installed) and not the other one (with Excel 2007 installed)?
- Is there some fundamental difference in the .xlsx formats for Excel 2007 and 2010? Can xlrd 0.9.2 read .xlsx files from either version?
- Is there anything I can do to make this file readable on multiple machines, with different versions of Office installed?
Any ideas on the above would be great. Thanks in advance.