0

I try to read and write .xlsx file with openpyxl. I just write text to one cell like below after read existing file.

sheet['F50'] = 'Hello'
enter code here

The file size of saved file is smaller than before. And I've get error message when read file with MS-Excel 2013.

"We found a problem with some content in 'working.xlsx', Do you want us to try to recover as much as we can? If you trust the source of this workbook, click yes."

After select yes. I've got another message.

Repaire to 'working.xlsx'
Excel was able to open the file by repairing or removing the unreadable content.
Removed Records: Named range from /xl/workbook.xml part(Workbook)

But I can see the 'Hello' on cell 'F50'. What's wrong with my code.

martineau
  • 119,623
  • 25
  • 170
  • 301
  • 1
    I think you should use `sheet['F50'] .value = 'Hello'`. Read this http://stackoverflow.com/questions/29901558/writing-data-into-excel-sheet-using-openpyxl-isnt-working – bzimor Nov 09 '16 at 10:53
  • 1
    Please post **all** the code you're using. – Charlie Clark Nov 09 '16 at 11:06
  • I got the same issue now, my code is the simplest: `import openpyxl; book = openpyxl,load_workbook(file1); book.save(file2)`. What is the solution? – Heinz Dec 20 '19 at 22:25

0 Answers0