Reputation: 1118
Say I want to update som data in example1.xlsx. Is this possible to do using openpyxl without having to save it as a new file?
Upvotes: 1
Views: 8071
Reputation: 6284
As far as I can tell you can open a workbook with openpyxl, modify some data, then save the workbook in place:
wb = openpyxl.load_workbook('path\\to\\workbook.xlsx')
c = wb['Sheet1']['A1']
c.value = 'hello'
wb.save('path\\to\\workbook.xlsx')
If you're saying that your workbook is too big to manipulate in this way, it looks as if you would have to open it in read-only mode, manipulate the data as you read it in, and write it to a new workbook in write-only mode.
Upvotes: 3