Could please someone show an example of applying the number format to the cell. For example, I need scientific format, form would be like \'2.45E+05\' but I couldn\'t figure
For openpyxl version 2.6.2: note the float display depends on the magnitude when in a python shell, or idle, or ipython session,
>>> wb = load_workbook('tmp.xlsx')
>>> ws = wb[wb.sheetnames[0]]
>>> c21 = ws.cell(2,1)
>>> c21.value
'43546'
>>> c21.value = int(c21.value)
>>> c21.value
43546
>>> c21.value = 134352345235253235.235235
>>> c21.number_format = '0.000E+00'
>>> c21.value
1.3435234523525323e+17
>>> c21.value = 534164134.6643
>>> c21.value
534164134.6643
>>> wb.save('tmp_a.xlsx')
>>> wb.close()
But do not be dismayed, because the '0.000E+00' format will be displayed correctly when you re-open the spreadsheet with MS-Excel or LibreOffice-Calc or Gnumeric. Just remember to save the workbook.