Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

XLRDError: Expected BOF record; found 0x4b50

Tags:

python

excel

I don't think there is something wrong with the codes. Can you help me? I need help. Thank you!

from xlrd import open_workbook

wb = open_workbook('/pdf-ex/exc.xlsx','rb')
for s in wb.sheets():
    print 'Sheet:',s.name
    for row in range(s.nrows):
        values=[]
        for col in range(s.ncols):
            values.append(s.cell(row,col).value)
        print ",".join(values)
    print
like image 454
wangling Avatar asked May 25 '12 08:05

wangling


People also ask

What is BoF record?

The BOF record specifies the beginning of the individual substreams as specified by the workbook section.

What is BoF error?

The error "Either BoF or EoF is True, or the current record has been deleted" indicates a problem either with the MLS database on the computer or with access to the database. The program cannot find the Beginning of File (BoF) or End of File (EoF) for some data records.


1 Answers

I had the same problem and resolved it by upgrading to version 0.8.0.

Prior to that version, xlsx/xlsm were not supported.

Release announcement: http://mail.python.org/pipermail/python-list/2012-August/627757.html

Latest version: https://pypi.python.org/pypi/xlrd/

like image 100
Brent Bradburn Avatar answered Nov 01 '22 00:11

Brent Bradburn