Re: pyExcelerator - Can I read and modify an existing Excel-WorkBook?
- From: John Machin <sjmachin@xxxxxxxxxxx>
- Date: Thu, 31 Jan 2008 14:11:27 -0800 (PST)
On Feb 1, 4:37 am, Stephen Brown <sbr...@xxxxxxxxxxxxxxx> wrote:
Yes indeed, pyExcelerator does support reading data from excel
spreadsheets.
I presume this is an orphaned and belated reply to the 3-message
thread in July 2006 with the same subject.
An example of how to do this is included in the file
xls2csv-gerry.py under the directory ... pyExcelerator/examples/tools
Syntax is pretty straight forward. extract_all = parse_xls(filename, CP
= None) where CP is the encoding format used within tht file.
The OP was aware of pyExcelerator's parse_xls, but required formatting
information:
"""
To me it seems, that pyExcelerator does not support the reading for
modification of an Excel-***. It allows only the "parse_xls" but I
would like to keep the "formatting" in the template.
"""
Uses
same codes that xlrd uses, ie 'cp437' = US English.
An interesting way of describing it. It is *not* restricted to being
a "codepage". The arg can be any Python-supported encoding that can be
passed to str.decode to convert internal 8-bit strings to unicode.
[snip]
All you need is the "parse_xls" command and simply let it iterate
through your spread*** file.
Current situation:
I am (sporadically) maintaining xlwt, a fork of pyExcelerator which
among other things fixes bugs and enables use with Python 2.3. It is
available from https://secure.simplistix.co.uk/svn/xlwt/trunk
xlwt.parse_xls is the same as pyExcelerator.parse_xls and thus has the
same deficiencies e.g. it reports a date as a floating-point number of
days since some more-or-less-fixed epoch and provides no indication
that the item should be interpreted as a date. It will not be
maintained, and is severely deprecated -- use xlrd instead.
HTH,
John
.
- References:
- pyExcelerator - Can I read and modify an existing Excel-WorkBook?
- From: Stephen Brown
- pyExcelerator - Can I read and modify an existing Excel-WorkBook?
- Prev by Date: Re: Naive idiom questions
- Next by Date: Re: Naive idiom questions
- Previous by thread: pyExcelerator - Can I read and modify an existing Excel-WorkBook?
- Next by thread: Python for mobiles
- Index(es):