Reputation: 2062
I have a large spreadsheet that I am processing in python. The source sheet has embeded excel formulas. I am using the libraries xlrd and xlwt. The formatting (such as hightlight) is copied from the source data, however formulas are not copied. How can this be resolved?
Code to copy the sheet;
def copy2(wb):
w = XLWTWriter()
process(XLRDReader(wb, 'unknown.xls'), w)
return w.output[0][1], w.style_list
Upvotes: 0
Views: 274
Reputation: 2062
It is not possible to do this with xlrt, xlwt. I have solved this by using the library xlwings. xlwings will add columns to already existing sheets without needing to copy the data to write to it. This will allow you to use python to add columns to already existing workbooks with formulas / vba / formatting.
Upvotes: 0