Using Python, write an Excel file with columns copied from another Excel file -


i have excel file containing varying number of columns, loop through columns (from header row value) of file using python, write (copy) columns excel file.

any examples on how can please?

here options choose from:

if need copy data (without formatting information), can use combination of these tools reading/writing. if have xls file, should go xlrd+xlwt option.

here's simple example of copying first row existing excel file new one:

import xlwt import xlrd  workbook = xlrd.open_workbook('input.xls') sheet = workbook.sheet_by_index(0)  data = [sheet.cell_value(0, col) col in range(sheet.ncols)]  workbook = xlwt.workbook() sheet = workbook.add_sheet('test')  index, value in enumerate(data):     sheet.write(0, index, value)  workbook.save('output.xls') 

Comments

Popular posts from this blog

Change php variable from jquery value using ajax (same page) -

How can I fetch data from a web server in an android application? -

jquery - How can I dynamically add a browser tab? -