Excel file containing image gets corrupted when trying to save the excel file twice
class TestExcel(): def init(self): self.filename = "file path" self.sheetName = "sheetname" self.workbook = openpyxl.load_workbook(self.filename) def saveWorkbook(self): self.workbook.save(self.filename) self.workbook.close()
obj = TestExcel() obj.saveWorkbook() obj.saveWorkbook()
this issue occurs with any excel file containing images Error : ValueError I/O on closed file