Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #56925 > unrolled thread
| Started by | John Mathew <john.mathew.python@gmail.com> |
|---|---|
| First post | 2013-10-16 16:28 -0700 |
| Last post | 2013-10-16 16:28 -0700 |
| Articles | 1 — 1 participant |
Back to article view | Back to comp.lang.python
Merging xls into a common one John Mathew <john.mathew.python@gmail.com> - 2013-10-16 16:28 -0700
| From | John Mathew <john.mathew.python@gmail.com> |
|---|---|
| Date | 2013-10-16 16:28 -0700 |
| Subject | Merging xls into a common one |
| Message-ID | <mailman.1140.1381972578.18130.python-list@python.org> |
[Multipart message — attachments visible in raw view] — view raw
This code works fine when there are xls in which Row has One column, but
not when Row has more column.
The expectation is to merge the different xls into a common one.
Can somebody please help.
import xlwt
import xlrd
import sys
#Create workbook and worksheet
wbk = xlwt.Workbook()
dest_sheet = wbk.add_sheet('Data_1')
for sheet_idx in range(1, 3):
sheet = xlrd.open_workbook('Data_%d.xls' % sheet_idx).sheet_by_index(0)
for i in range(5):
values = sheet.row_values(i)
for idx, element in enumerate(values):
dest_sheet.write(i, sheet_idx+idx, element)
wbk.save('DATA.xls')
Back to top | Article view | comp.lang.python
csiph-web