Problem With Content
*Created originally on Bitbucket by [Dan K (Dan Kanefsky)](https://bitbucket.org/%7B1a2b42fc-195e-4923-891d-b178b483d396%7D/)* I have an excel file exported from File Maker Pro and even if I load the workbook and save without reading or writing anything: ```python wb = openpyxl.load_workbook('Original.xlsx') wb.save('Original.xlsx') ``` it gives me this error when I open it up after running it through openpyxl. ![](https://bitbucket.org/repo/RMdExx/images/2312336166-excel%20error.jpeg) ‌ If I click Yes, it give me an option to view the error xml file: ```xml <?xml version="1.0" encoding="UTF-8" standalone="yes"?> <recoveryLog xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main"> <logFileName>Repair Result to new1.xml</logFileName> <summary>Errors were detected in file '/Volumes/post/new.xlsx'</summary> <removedParts summary="Following is a list of removed parts:"> <removedPart>Removed Part: /xl/styles.xml part with XML error. (Styles) HRESULT 0x8000ffff</removedPart> </removedParts><repairedRecords summary="Following is a list of repairs:"> <repairedRecord>Repaired Records: Cell information from /xl/worksheets/sheet1.xml part</repairedRecord> </repairedRecords> </recoveryLog> ``` Once I repair the file, everything is fine except there is no styling throughout the workbook \(bold headers, fonts, etc\). HOWEVER, if I simply open and then save the excel file before running it through openpyxl, it does not throw that error and everything is fine. **I would really like to avoid this alert without having to manually open up each excel file.** It might have to do with the excel file out of File Maker missing a line in the XML and a “themes” file. I’ve compared all three XML’s by opening up with excel file with textwrangler. For reference: “Original” – the XML of the original excel file straight out of File Maker “Saved” – is the XML of the original file simply opened up in excel and saved, no changes were made. “Original RAN” and “Saved RAN” – is the xml after I loaded and saved with openpyxl “Original RAN Recovered” – is the xml after the Original was run through openpyxl then opened up in excel, repaired and then saved. ‌ ```xml <!--Original--> <?xml version="1.0" encoding="UTF-8" standalone="yes"?> <Types xmlns="http://schemas.openxmlformats.org/package/2006/content-types"> <Default ContentType="application/vnd.openxmlformats-package.relationships+xml" Extension="rels"/> <Default ContentType="application/xml" Extension="xml"/> <Override ContentType="application/vnd.openxmlformats-officedocument.spreadsheetml.sheet.main+xml" PartName="/xl/workbook.xml"/> <Override ContentType="application/vnd.openxmlformats-officedocument.extended-properties+xml" PartName="/docProps/app.xml"/> <Override ContentType="application/vnd.openxmlformats-officedocument.spreadsheetml.worksheet+xml" PartName="/xl/worksheets/sheet1.xml"/> <Override ContentType="application/vnd.openxmlformats-officedocument.spreadsheetml.sharedStrings+xml" PartName="/xl/sharedStrings.xml"/> <Override ContentType="application/vnd.openxmlformats-package.core-properties+xml" PartName="/docProps/core.xml"/> <Override ContentType="application/vnd.openxmlformats-officedocument.spreadsheetml.styles+xml" PartName="/xl/styles.xml"/></Types> <!-- Saved --> <?xml version="1.0" encoding="UTF-8" standalone="yes"?> <Types xmlns="http://schemas.openxmlformats.org/package/2006/content-types"> <Default Extension="rels" ContentType="application/vnd.openxmlformats-package.relationships+xml"/> <Default Extension="xml" ContentType="application/xml"/> <Override PartName="/xl/workbook.xml" ContentType="application/vnd.openxmlformats-officedocument.spreadsheetml.sheet.main+xml"/> <Override PartName="/xl/worksheets/sheet1.xml" ContentType="application/vnd.openxmlformats-officedocument.spreadsheetml.worksheet+xml"/> <Override PartName="/xl/theme/theme1.xml" ContentType="application/vnd.openxmlformats-officedocument.theme+xml"/> <Override PartName="/xl/styles.xml" ContentType="application/vnd.openxmlformats-officedocument.spreadsheetml.styles+xml"/> <Override PartName="/xl/sharedStrings.xml" ContentType="application/vnd.openxmlformats-officedocument.spreadsheetml.sharedStrings+xml"/> <Override PartName="/docProps/core.xml" ContentType="application/vnd.openxmlformats-package.core-properties+xml"/> <Override PartName="/docProps/app.xml" ContentType="application/vnd.openxmlformats-officedocument.extended-properties+xml"/></Types> <!-- Original RAN --> <Types xmlns="http://schemas.openxmlformats.org/package/2006/content-types"> <Default ContentType="application/vnd.openxmlformats-package.relationships+xml" Extension="rels" /> <Default ContentType="application/xml" Extension="xml" /> <Override ContentType="application/vnd.openxmlformats-officedocument.spreadsheetml.styles+xml" PartName="/xl/styles.xml" /> <Override ContentType="application/vnd.openxmlformats-officedocument.theme+xml" PartName="/xl/theme/theme1.xml" /> <Override ContentType="application/vnd.openxmlformats-package.core-properties+xml" PartName="/docProps/core.xml" /> <Override ContentType="application/vnd.openxmlformats-officedocument.extended-properties+xml" PartName="/docProps/app.xml" /> <Override ContentType="application/vnd.openxmlformats-officedocument.spreadsheetml.worksheet+xml" PartName="/xl/worksheets/sheet1.xml" /> <Override ContentType="application/vnd.openxmlformats-officedocument.spreadsheetml.sheet.main+xml" PartName="/xl/workbook.xml" /> </Types> <!-- Saved RAN --> <Types xmlns="http://schemas.openxmlformats.org/package/2006/content-types"> <Default ContentType="application/vnd.openxmlformats-package.relationships+xml" Extension="rels" /> <Default ContentType="application/xml" Extension="xml" /> <Override ContentType="application/vnd.openxmlformats-officedocument.spreadsheetml.styles+xml" PartName="/xl/styles.xml" /> <Override ContentType="application/vnd.openxmlformats-officedocument.theme+xml" PartName="/xl/theme/theme1.xml" /> <Override ContentType="application/vnd.openxmlformats-package.core-properties+xml" PartName="/docProps/core.xml" /> <Override ContentType="application/vnd.openxmlformats-officedocument.extended-properties+xml" PartName="/docProps/app.xml" /> <Override ContentType="application/vnd.openxmlformats-officedocument.spreadsheetml.worksheet+xml" PartName="/xl/worksheets/sheet1.xml" /> <Override ContentType="application/vnd.openxmlformats-officedocument.spreadsheetml.sheet.main+xml" PartName="/xl/workbook.xml" /> </Types> <!-- Original Ran Revoered (SAVED) --> <?xml version="1.0" encoding="UTF-8" standalone="yes"?> <Types xmlns="http://schemas.openxmlformats.org/package/2006/content-types"> <Default Extension="rels" ContentType="application/vnd.openxmlformats-package.relationships+xml"/> <Default Extension="xml" ContentType="application/xml"/><Override PartName="/xl/workbook.xml" ContentType="application/vnd.openxmlformats-officedocument.spreadsheetml.sheet.main+xml"/> <Override PartName="/xl/worksheets/sheet1.xml" ContentType="application/vnd.openxmlformats-officedocument.spreadsheetml.worksheet+xml"/> <Override PartName="/xl/theme/theme1.xml" ContentType="application/vnd.openxmlformats-officedocument.theme+xml"/> <Override PartName="/xl/styles.xml" ContentType="application/vnd.openxmlformats-officedocument.spreadsheetml.styles+xml"/> <Override PartName="/xl/sharedStrings.xml" ContentType="application/vnd.openxmlformats-officedocument.spreadsheetml.sharedStrings+xml"/> <Override PartName="/docProps/core.xml" ContentType="application/vnd.openxmlformats-package.core-properties+xml"/> <Override PartName="/docProps/app.xml" ContentType="application/vnd.openxmlformats-officedocument.extended-properties+xml"/></Types> ``` ‌ Line 22 is the one discrepancy between the Original excel XML and the Saved XML. However, I’m not sure what this actually means. Unfortunately I cannot provide the original.xlsx file because it has private information and as soon as I open up and save the file, there are no issues. Appreciate any insight! I hope I provided enough info. *Attachments:* [Original.xml](/uploads/cbb03f4b84895c40b2f52a5e64907fd2/Original.xml)[saved.xml](/uploads/71d7883645fe8b0f4fda6dbfb1729a4f/saved.xml)[Original_2.xml](/uploads/4730d4468439d77107eedebf6232d5a5/Original_2.xml)[Saved_2.xml](/uploads/87ffa4a51027c64903b0a866e0daf5db/Saved_2.xml)[Original_style.xml](/uploads/ffa4a95eee171110145e615c6f54a9c3/Original_style.xml)[Saved_style.xml](/uploads/45da86123289005dd26de861da3f01f2/Saved_style.xml)
issue