"We found a problem with some content in copy.xlsx" Openpyxl 3.0.3, open and save with no changes to file
Created originally on Bitbucket by Ryan
openpyxl versions tested: 3.0.0 and 3.0.3
python versions tested: 3.6 and 3.7
Code to reproduce (I’ve attached the referenced files to this ticket):
import openpyxl
wb = openpyxl.load_workbook('/Users/ryan/Downloads/original.xlsx')
wb.save('/Users/ryan/Downloads/copy.xlsx')
After running this code, if I attempt to open copy.xlsx
I get the following error:
and here’s the XML ”Repair result” report generated by excel
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<recoveryLog xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main">
<logFileName>Repair Result to copy0.xml</logFileName>
<summary>Errors were detected in file '/Users/ryan/Downloads/copy.xlsx'</summary>
<removedParts summary="Following is a list of removed parts:">
<removedPart>Removed Part: Drawing shape.</removedPart>
</removedParts>
<repairedRecords summary="Following is a list of repairs:">
<repairedRecord>Repaired Records: Drawing from /xl/drawings/drawing1.xml part (Drawing shape)</repairedRecord>
</repairedRecords>
</recoveryLog>
I’ve seen vaguely similar reports to this both in the official issue tracker and more commonly in old stackoverflow posts, but all of them that were resolved were resolved by upgrading openpyxl to much older versions than the ones I’ve tried.
Attachments: original.xlsxcopy.xlsx