I am trying to write an array (data = [][]) to a worksheet I will create using xlwt. My question is can I specify a column to start from? I am planning to use a for loop to iterate through the array retrieving the values row by row starting a new line with each row ex: first row starts at C1, next row starts at C2 etc... I have read the documentation and examples but cannot find a clear way to do this. Any help would be greatly appreciated!
Asked
Active
Viewed 2,748 times
3
-
Insert two blank cells at the front of each row? – Thomas K Jun 21 '11 at 20:59
-
The examples are included in the documentation if one knows where to look... Also typing the first '(' will often give a description of the parameters a method accepts and what they do – Corey Jul 13 '11 at 14:07
1 Answers
5
Something like:
wb = xlwt.Workbook()
ws = wb.add_sheet('Sheet1')
for r, row in enumerate(data):
for c, col in enumerate(row):
ws.write(r, 2 + c, label=col)

Gerrat
- 28,863
- 9
- 73
- 101