How to edit and save the data in an existing excel workbook using xlrd, xlwt and xlutils module? could someone please provide a sample code to edit and save the data in excel workbook?
I am trying to put data from one workbook to another.
import xlrd, xlwt, xlutils
wb1 = xlrd.open_workbook('workbook1.xls', formatting_info=True)
wb2 = xlrd.open_workbook('workbook2.xls', formatting_info=True)
value 1 == wb2.sheet_by_name('Sheet1).cell(2,1).value
wb1.sheet_by_name('Sheet1').cell(2,2).value == value1
How to save this data in workbook1.xls?
Sorry, I asked this before, but I am trying to be more clear about my question this time.
Thank you very much.
You can save with wb1.save('workbook1.xls')
. You might get an IOError that the file already exists. In that case try to os.remove()
the file before saving.