By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
446,365 Members | 1,578 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 446,365 IT Pros & Developers. It's quick & easy.

pyXLWriter - simple example code ?

P: n/a
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.
Jul 18 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a

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

Aurelio
Jul 18 '05 #2

P: n/a
Aurelio Martin Massoni <am*****@wpsnetwork.com> wrote in message news:<2o************@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.
Jul 18 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.