Error Message while opening the file:
Excel found unreadable content in zz.xlsx. Do you want to recover the contents of the work book?If you trust the source of the workbook,click Yes.
If I say "Yes" got "Repairs to zz.xlxs" pop up shows.
Could any one please help me. What format of the excel could have caused this. As i tried sample workbook without any formatting it work fine.
My code :
from openpyxl import Workbook
from openpyxl import load_workbook
#open existing workbook
wb = load_workbook(filename = 'xx.xlsx')
wb.save('zz.xlsx')
Appreciate your help. Thanks!
First of all check if your file *.xlsx format is "Office Open XML" or "XML from Microsoft Excel 2007/2010/2013". If this is the format it will work OK.
By default the file is not saved as a template, you can define it to try if this is causing the error. Openpyxl documentation
wb = load_workbook('document.xlsx')
wb.save('document_template.xltx', as_template=False)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With