xlrd error opening file.

2,226 views
Skip to first unread message

Rakesh

unread,
Aug 20, 2008, 7:45:55 AM8/20/08
to python-excel
Hi All,

I have an Excel file that is downloaded from an external website
daily. I need to access the information within this file and cross
reference against our database.
It appears that the XLS file is created using Crystal Reports
(according to the file information in OpenOffice)

<code>
f = "/trans/pricing/safex/qa/FullStats19082008.xls"
book = xlrd.open_workbook(f)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/lib/python2.5/site-packages/xlrd/__init__.py", line 121,
in open_workbook
logfile=logfile, verbosity=verbosity, pickleable=pickleable,
use_mmap=use_mmap,
File "/usr/lib/python2.5/site-packages/xlrd/__init__.py", line 304,
in __init__
raise XLRDError("Can't find workbook in OLE2 compound document")
xlrd.biffh.XLRDError: Can't find workbook in OLE2 compound document
</code>

Now if I re-save this document in OpenOffice, I can open it using xlrd
pyExcelerator is also having the same problem, but Perl's
Spreadsheet::ParseExcel seems to work.

I would really prefer to work in Python and not Perl so any help would
be most appreciated.

The Excel file(s) in question can be viewed here :
http://www.safex.co.za/pub/EdmStats/FullStats19082008.xls

Thank you.

Regards,

Rakesh

John Machin

unread,
Aug 20, 2008, 8:55:15 AM8/20/08
to python-excel
From the HISTORY.html file:
"""
Version 0.6.1a2
<snip>
* Crystal Reports writes "WORKBOOK" in the OLE2 Compound Document
directory instead of "Workbook". Changed to case-insensitive directory
search.
"""

Get the latest released version (0.6.1) from http://pypi.python.org/pypi/xlrd

Cheers,
John

Rakesh

unread,
Aug 20, 2008, 9:03:52 AM8/20/08
to python-excel
Brilliant! That worked.

Thanks a lot John!!

Cheers
Reply all
Reply to author
Forward
0 new messages