pyXLWriter - simple example code ?

R

Richard Shea

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.
 
A

Aurelio Martin Massoni

Richard said:
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

Aurelio
 
R

Richard Shea

Aurelio Martin Massoni said:
########################################################################

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,012
Latest member
RoxanneDzm

Latest Threads

Top