pyXLWriter - simple example code ?

Richard Shea richardshea at fastmail.fm
Mon Aug 23 06:23:44 EDT 2004


Aurelio Martin Massoni <amartin at wpsnetwork.com> wrote in message news:<2omnt7FcdpspU1 at uni-berlin.de>...
> Richard Shea wrote:
> > Hi - Anyone out there who has a simple example using pyXLWriter
> > (http://sourceforge.net/projects/pyxlwriter/) they are willing to
> > share with the group ?
> > 
> > I'm interested in creating a .XLS which has multiple sheets within the
> > workbook but I'm having real trouble getting started, I can create a
> > Worksheet but can't figure out how to save it.
> > 
> > thanks
> > 
> > richard shea.
> 
> ########################################################################
> 
> import pyXLWriter
> 
> wb = pyXLWriter.Workbook( 'test.xls' )
> ws1 = wb.add_worksheet( 'First' )
> ws2 = wb.add_worksheet( 'Second' )
> ws1.write( "A1", "January" )
> ws1.write( "A2", "February" )
> ws1.write( "A3", "March" )
> ws1.write( "B1", 1.25 )
> ws1.write( "B2", 2.50 )
> ws1.write( "B3", 1.80 )
> wb.close()
> 
> ########################################################################
> 
> Hope this helps

Hi Aurelio - Thanks for this I appreciate it, gave me a starting point
which I needed ! Just for other W32/Python people reading this the W32
style .EXE doesn't contain as much example material as the downloads
so it's worth using the .EXE to install the package but then taking a
peek inside the one of the others at the example directory. I used
Aurelio's code and then extended it based upon what I read in the
examples. An unexpected plus is that the XML files produced are able
to be read by Excel97 whereas I was assuming it was Excel2000 and
upwards.

Thanks again Aurelio.

regards

richard shea.



More information about the Python-list mailing list