Bug: Opening and saving any xlsx file corrupts it
Hi. This is similar to other bug reports, but I couldn't find one that is open and the same situation as mine, or closed and had a solution that helped me. Just opening and saving an existing xlsx file corrupts it for me (Python runs with no errors). It does the same thing on any file I use, even a newly created one with no data in it. When opening the file in Excel it asks if I want to recover the file (image below). Once I recover the file, if it had data and formatting before, everything seems fine (at least data and formatting). Excel recover log shows nothing useful. ![image](/uploads/1513b8e10353fafcd7d4dbcbc18d4df3/image.png) I don't know what I'm looking at exactly, but from inspecting the files as archives, the file sizes between the original and corrupt are considerably different (original 14KB, corrupt 5KB). My code: ``` import openpyxl file = "Book1.xlsx" wb = openpyxl.load_workbook(file) wb.save(file) ``` Original and corrupt files attached: - [Book1_Original.xlsx](/uploads/046989a8d3ca1e0660e05716a9229264/Book1_Original.xlsx) - [Book1_Corrupt.xlsx](/uploads/a22df9857ddd538f7b18d75160106dbe/Book1_Corrupt.xlsx) Versions: - openpyxl 3.0.10 - pandas 1.5.2 (I was originally using this and having the same issue, I narrowed it down to openpyxl's save function) - Python 3.10 (I'm also planning to use this in Revit Dynamo which runs Python 3.8.3) - Windows 10 22H2 19045.2311 - Excel Version 2210 Build 16.0.15726.20188 64-bit
issue