Using XLRD: Error while opening an excel file.

Asked by vandana

I have downloaded xlrd package and placed in to SIKULI X/LIB folder.
Book1.xls is my xls file present on D: drive.

below is my script:

import xlrd

wb = xlrd.open_workbook("D:\\Book1.xls")

when i execute this scrip i am getting following error message:

[error] Stopped
[error] An error occurs at line 3
[error] Error message: Traceback (most recent call last):
 File "C:\Users\amrutada\AppData\Local\Temp\sikuli-tmp5913927366881109490.py", line 3, in
 wb = xlrd.open_workbook("D:\\Book1.xls")
File ".\xlrd\__init__.py", line 429, in open_workbook
 biff_version = bk.getbof(XL_WORKBOOK_GLOBALS)
 File ".\xlrd\__init__.py", line 1545, in getbof
 bof_error('Expected BOF record; found %r' % self.mem[savpos:savpos+8])
 File ".\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'

Question information

Language:
English Edit question
Status:
Solved
For:
SikuliX Edit question
Assignee:
No assignee Edit question
Last query:
Last reply:
Revision history for this message
RaiMan (raimund-hocke) said :
#1

xlrd problem:

XLRDError: Unsupported format, or corrupt file: Expected BOF record; found 'PK\x03\x04\x14\x00\x06\x00'

Your XLS seems not to be accepted. Unicode problem?

Consult the docs of xlrd or some xlrd board.

Not a Sikuli Question.

Revision history for this message
RaiMan (raimund-hocke) said :
#2

not a Sikuli problem

Revision history for this message
Vik Raisings (nilkornor) said :
#3

Your excel file can be corrupted. It might be system error, virus, incorrect action of antivirus software or etc. In this case you may try tool below

http://www.excel.fixtoolbox.com

it recovers *.xls, *,xlt, *.xlsx, *.xlsm, *.xltm, *.xltx and *.xlam formats. It saves the original structure of file during restoration.