Error when opening Excel file generated by openpyxl

301 views
Skip to first unread message

Adi

unread,
Aug 30, 2021, 10:00:19 AM8/30/21
to openpyxl-users

Hi,

The attached Excel file was generated with openpyxl (version 3.0.6). When opening this file in Excel 2016 I sometimes receive the below error:

"We found a problem with some content in '<filename.xlsx>'. Do you want to recover as much as we can? If you trust the source of this workbook, click Yes"

The log file of Excel's repair doesn't provide any insight on what went wrong.

The problem isn't fully reproducible. Sometimes the file opens correctly but sometimes I get an error. However, once this error has been received the file can no longer be opened correctly, until the file is recovered. After the file is recovered the error is gone.

The script generates an Excel file with 4 Work Sheets. The first three are empty and the last one contains 13 empty scatter charts. It seems that if we decrease the number of scatter charts (<13) or decrease the number of worksheets (<4) the file that is generated can be opened correctly.

Attached are the script and the corrupted Excel file. Any advice or direction on how to resolve this issue would be very much appreciated.

create_scatter_charts.py
scatter_charts.xlsx

Adi

unread,
Oct 5, 2021, 2:37:28 AM10/5/21
to openpyxl-users
Hi,
I am still encountering the issue below and am completely at loss as to how to proceed. Any direction or guidance will be greatly appreciated.
ב-יום שני, 30 באוגוסט 2021 בשעה 17:00:19 UTC+3, Adi כתב/ה:

Soufiane Khoudir

unread,
Oct 5, 2021, 3:03:44 PM10/5/21
to openpyxl-users
Hello,

I don't have any issue with your code and the excel sheet, everythings work fine for me.

Have you tried to delete your actual version of excel and installed a new one ?

Keep it up !
Message has been deleted

Adi

unread,
Oct 9, 2021, 3:39:17 PM10/9/21
to openpyxl-users
Hi,
Thanks for looking at this problem.
I tried creating the excel via the script on a machine with only an Excel 365 installation and the file opened correctly. When copying the file over to the machine with Excel 2016, it displayed the error message ("We found a problem with some content in '<filename.xlsx>'. Do you want to recover as much as we can? If you trust the source of this workbook, click Yes") when opened. 
I suppose this can be a workaround at this stage. 

ב-יום שלישי, 5 באוקטובר 2021 בשעה 22:03:44 UTC+3, soufian...@gmail.com כתב/ה:
Reply all
Reply to author
Forward
0 new messages