Converting a .xls file to .html

John Machin sjmachin at lexicon.net
Wed Dec 3 15:51:44 EST 2008


On Dec 4, 12:57 am, Tino Wildenhain <t... at wildenhain.de> wrote:
> Hi,
>
> tarun wrote:
> > Hello All,
>
> > I've a .xml file (saved as .xls) that can be opened in Microsoft excel.

The file extension is only a vague indication of the *format* of the
contents. How was it created?

>
> Well if its an xml file then just attach a style to it and you can
> just view it in a browser w/o involving excel in the first place.
>
> Also there are lots of xml libraries coming with python so you can
> translate it directly into HTML of your choice.
>
> > I want to write python code that converts this excel file into .html (so
> > that it can be viewed as is in an explorer).
>
> Whats an Explorer? I guess you mean Webbrowser here?
>
> Now if you manage to have it in Excel, then you could just save
> it as HTML (or whatever Microsoft believes is HTML).

Possibly an "Internet Explorer" :-)

>
> If the file is stored elsewhere in Excel-Format, then
> you could script that using xlrd (google for it)

I'm not sure what "stored elsewhere in Excel-Format" means. Currently
xlrd reads only files written by Excel 2.0 up to Excel 2003 in the
default "save as .XLS" binary format i.e. "BIFF2" to "BIFF8" format.

I'd suggest that the OP inquire further in the python-excel group at
http://groups.google.com/group/python-excel ... it would be a good
idea to state how the file was created (or supply the first 100 or so
bytes for inspection) plus what he really wants to achieve with the
file and is this a one-off or regular exercise.

HTH,

John




More information about the Python-list mailing list