J
John Mathew
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')
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')