Code
# Your code here
book = load_workbook(self.template_excel_path, data_only=True, keep_links=True)
writer = pandas.ExcelWriter(self.template_excel_path, engine='openpyxl')
writer.book = book
writer.sheets = dict((ws.title, ws) for ws in book.worksheets)
data_filtered.to_excel(writer, sheet_name, startrow=startrow,
startcol=startcol, index=False, header=None)
writer.save()
writer.close()
Problem description
I have a Excel template, and it contains some charts, when I use to_excel
write some data to excel, the charts will disappear,I want to write data to excel and retain chats, what should I do?
Comment From: jreback
this overwrites the sheet. not sure if there is a way to preserve these.