KeyError when saving workbook
问题 The file transactions.xlsx is not updated and this is precisely due to add_chart(). If I comment out add_chart all these errors does not arise but I want to draw chart and this is the only method I know. transanctions2.xlsx file is created but it is corrupted whereas bunch of errors do come up. from openpyxl.chart import BarChart, Reference wb1 = xl.load_workbook('transactions.xlsx') sheet = wb1['Sheet1'] cell = sheet.cell(1, 1) for row in range(2, sheet.max_row + 1): cell = sheet.cell(row, 3