The following code runs without problems:
import openpyxl book= openpyxl.Workbook() sheet= book.active sheet['A1']= 'int' sheet['B1']= 'float' sheet['C1']= 'complex' sheet['A2']= 5 sheet['B2']= 5.3 sheet['C2']= 5.3+2.J book.save('test.xlsx')
But, when I attempt to open the file with MS Excel, I get the following error message: "Excel found unreadable content in 'text.xlsx'. Do you want to recover the contents of the workbook?
If I comment out the line that writes the complex number, the file can be opened without problems. So, it would appear that openpyxl is writing the complex value in some way that Excel doesn't like.
Phillip M. Feldman