Help! Trouble Opening Excel file in xlrd

133 views
Skip to first unread message

Alok

unread,
Sep 23, 2008, 8:43:01 PM9/23/08
to python-excel
Hi,

I am new to xlrd and am hoping someone can help me figure out an error
I am getting when I try to open the following Excel file of the
components of the Dow Jones Industrial Average
link here: http://www.djindexes.com/mdsidx/index.cfm?event=components&symbol=DJC
(Source: http://www.djindexes.com/mdsidx/?event=showAverages)

Could someone advise what I can do to work-around the error I am
getting?

When I try to open the file in python 2.5 using xlrd 0.6.1 gives me
the following error:

In [9]: xlrd.open_workbook('ComponentReport-DJI.xls')
---------------------------------------------------------------------------
XLRDError Traceback (most recent call
last)

/Users/alok/Desktop/<ipython console> in <module>()

/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-
packages/xlrd/__init__.pyc in open_workbook(filename, logfile,
verbosity, pickleable, use_mmap, file_contents, encoding_override,
formatting_info)
368 t1 = time.clock()
369 bk.load_time_stage_1 = t1 - t0
--> 370 biff_version = bk.getbof(XL_WORKBOOK_GLOBALS)
371 if not biff_version:
372 raise XLRDError("Can't determine file's BIFF version")

/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-
packages/xlrd/__init__.pyc in getbof(self, rqd_stream)
1321 raise XLRDError('Expected BOF record; met end of
file')
1322 if opcode not in bofcodes:
-> 1323 raise XLRDError('Expected BOF record; found 0x
%04x' % opcode)
1324 length = self.get2bytes()
1325 if length == MY_EOF:

XLRDError: Expected BOF record; found 0x4f43

Alok

unread,
Sep 23, 2008, 8:48:03 PM9/23/08
to python-excel
Reply all
Reply to author
Forward
0 new messages