The error message refers to the BOF (beginning of file) entry of the .xls file. However, the example shows that you are trying to read the XLSX file.
There are two possible reasons for this:
- Your version of xlrd is deprecated and does not support reading xlsx files.
- The XLSX file is encrypted and thus stored in the OLE Compound Document format, rather than the zip format, which makes it xlrd an older XLS file.
Double check that you are using the latest version of xlrd. Opening a new XLSX file with data in only one cell should verify this.
However, I would suggest that you are faced with the second condition and that the file is encrypted, as you state above that you are already using xlrd version 0.9.2.
XLSX files are encrypted if you explicitly use the workbook password, and also if you password protect some elements of the worksheet. Thus, it is possible to have an encrypted XLSX file, even if you do not need a password to open it.
Update : see @BStew, the third, more likely, answer that the file is open by Excel.
jmcnamara
source share