How can I retain all formatting and images in and existing Excel file, when using OpenPyxl to modifiy?
Running this script on an existing Excel (Office 365 Version 1811) .xlsx data file has removed all images and merged cells.
import openpyxl
template = "Reporter_R2.xlsx"
wb = openpyxl.load_workbook(template)
sheets = wb.sheetnames
header_sht = wb['Sheet1']
result_sht = wb['Pre-Test Data']
header_sht.cell(row=1, column=1, value = "{}".format('StartOfTest'))
wb.save(template)
The 'template' file I am reading and writing has several sheets with lots of formatting so it will be helpful to retain the original formatting after making small changes with openpyxl.
I am using Python 3.6.7 with openpyxl 2.5.9.