On Dec 8, 9:02 pm, John Machin <[EMAIL PROTECTED]> wrote: > On Dec 9, 12:19 pm, JodyGnumeric <[EMAIL PROTECTED]> wrote: > > > > > On Dec 8, 5:54 am, John Machin <[EMAIL PROTECTED]> wrote: > > > > On Dec 8, 6:48 pm, "Gabriel Genellina" <[EMAIL PROTECTED]> wrote: > > > > > En Fri, 05 Dec 2008 02:31:01 -0200, pk sahoo <[EMAIL PROTECTED]> > > > > escribió: > > > > > > hallo everybody, > > > > > when i am running the following command > > > > > >>>> import xlrd > > > > >>>> book=xlrd.open_workbook("C:\\a.xls") > > > > > > i am getting the following error.. > > > > > > *Traceback (most recent call last): > > > > > File "<stdin>", line 1, in <module> > > > > > File "C:\Python25\Lib\site-packages\xlrd\__init__.py", line 370, in > > > > > open_workb > > > > > ook > > > > > biff_version = bk.getbof(XL_WORKBOOK_GLOBALS) > > > > > File "C:\Python25\Lib\site-packages\xlrd\__init__.py", line 1323, in > > > > > getbof > > > > > raise XLRDError('Expected BOF record; found 0x%04x' % opcode) > > > > > xlrd.biffh.XLRDError: Expected BOF record; found 0x3f3c* > > > > > Looks like your a.xls file is not an Excel file (one of the formats > > > > supported by xlrd). > > > > As 0x3f3c corresponds to the characters '<?' you probably have an XML > > > > file. > > > > This can be verified easily by opening the file with a simple-minded > > > text editor (e.g. Notepad) ... if the first two lines are > > > """ > > > <?xml version="1.0"?> > > > <?mso-application progid="Excel.Sheet"?> > > > """ > > > then it's an Excel 2003 XML Spreadsheet that's been manually(?) > > > renamed from .xml to .xls. > > > > The current xlrd release supports only the binary ("BIFF") format .xls > > > files created by Excel 3.0 to Excel 2003. The next release (due out > > > Real Soon Now) will support Excel 2.1 and 2.0 formats [don't ask]. > > > Very soon after that will come support for Excel 2007 .xlsx which is a > > > bunch of XML files inside a ZIP file. Support for Excel 2003 > > > "SpreadsheetML" is way down the to-do list. > > > > If the OP wants to be able to read the file with xlrd: > > > (1) Open it with Excel 200[37] and save as a .xls file > > > or (2) rename it to .xml, start OpenOffice.org Calc, click on File, > > > click on Open, click on "Files of type", choose "Microsoft Excel 2003 > > > XML (*.xml)" from the (long, unsorted) drop-down list, ..., and save > > > as etc etc. Gnumeric is not an option. > > > > HTH, > > > John > > > Gnumeric can read this format. 'MS Excel (tm) 2003 SpreadsheetML' > > [Gnumeric 1.9.1 on Windows XP] > > I'm sorry; I thought I'd exhausted every possible way of trying to > open it. After looking at the file open dialogue box again, I've > spotted the "Advanced" button. Here is what you need to do: > > Have the file named whatever.xls. Click on File / Open , navigate to > correct directory, click on Advanced, choose 'MS Excel (tm) 2003 > SpreadsheetML' from the File-type drop-down list, choose the file, > click on OK. Anything else (Simple (non-Advanced), naming it > whatever.xml, ...) produces no response, yes that's zero bits of > information, not even a Bzzzzt! noise :-( > > *AND* when it does open up, a date cell defined by > <Style ss:ID="s21"> > <NumberFormat ss:Format="Short Date"/> > </Style> > ... > <Cell ss:StyleID="s21"><Data > ss:Type="DateTime">1999-12-31T00:00:00.000</Data></Cell> > > is displayed as "00ort 31at1999" :-(
Please send the file to bugzilla.gnome.org it sounds like I need to improve the probe function function for this format and add support for the magic named formats. -- http://mail.python.org/mailman/listinfo/python-list