473,473 Members | 1,764 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

pyExcelerator: writing multiple rows

Hi all,

I was just curious if there was a built-in or a more efficient way to
do take multiple rows of information and write them into excel using
pyExcelerator. This is how I resolved the problem:

from pyExcelerator import *

data = [[1,2,3],[4,5,'a'],['','s'],[6,7,'g']]

wb=pyExcelerator.Workbook()
test = wb.add_sheet("test")

c=1
r=0
while r<len(data):
for d in data[r]:
test.write(r,c,d)
c+=1
r+=1
c=1
wb.save('c:\\1\\test.xls')
Jan 19 '08 #1
1 2272
On Jan 19, 7:46�am, patrick.wa...@gmail.com wrote:
Hi all,

I was just curious if there was a �built-in or a more efficient way to
do take multiple rows of information and write them into excel using
pyExcelerator. �This is how I resolved the problem:

from pyExcelerator import *

data = [[1,2,3],[4,5,'a'],['','s'],[6,7,'g']]

wb=pyExcelerator.Workbook()
test = wb.add_sheet("test")

c=1
r=0
while r<len(data):
� � for d in data[r]:
� � � � test.write(r,c,d)
� � � � c+=1
� � r+=1
� � c=1
wb.save('c:\\1\\test.xls')
Try this:

for row,rowdata in enumerate(data):
for col,cell in enumerate(rowdata):
test.write(row,col,cell)
If you need row & col offsets, add them.

row_offset = 7
col_offset = 3
for row,rowdata in enumerate(data):
for col,cell in enumerate(rowdata):
test.write(row+row_offset,col+col_offset,cell)
Jan 19 '08 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Marco Aschwanden | last post by:
Hi, Yesterday I placed a bug report on PyExcelerators-Sourceforge-page... but I am not so sure anymore, whether this is really a bug - I could imagine that I missed something, but I don't see...
3
by: tkpmep | last post by:
I downloaded PyExcelerator.zip as I need to write some data into Excel files, and tried unsuccessfully to install it. I unzipped the files into C:/Python24/Lib/site-packages/PyExcelerator, and in a...
2
by: tkpmep | last post by:
I have just installed PyExcelerator, and now want to use it to read Excel spreadsheets with a variable number of rows and columns and with multiple sheets. Unfortunately, no documentation seems to...
1
by: tkpmep | last post by:
I write data to Excel files using PyExcelerator 0.6.3.a and have done so successfully for small files (10-15 cells). I'm experiencing an error when writing a big chunk of data (10,000 cells) to...
4
by: Marco Aschwanden | last post by:
Hi I would like to 1. import an existing Excel-sheet (a template) 2. and add some data to it 3. and save it under a different name afterwards. To me it seems, that pyExcelerator does not...
3
by: implicate_order | last post by:
Greetings, I'm new to python and am in the process of writing a script to parse some CSV data, spread it across multiple Excel worksheets and then generate charts. I searched the internet to...
5
by: susan | last post by:
Hi, I'm new of Python, and this problem stucked me whole day but can't be solved. I use python 2.4.3, which is download from cygwin packages. Then I downloaded pyexcelerator-0.5.3a, unzip it, ...
3
by: tkpmep | last post by:
My program creates three lists: the first has dates expressed as strings, the second has floats that are strictly positive, and the third has floats that are strictly negative. I have no trouble...
1
by: aneesh.goel.rbtx | last post by:
I'm using pyExcelerator to take a folder of CSV files and create Excel workbooks for all of them, then generate an Excel workbook with the data from all of them. Everything up until here works...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.