Quote from docs:
Those worksheet only have an append() method, it’s not possible to
access independent cells directly (through cell() or range()). They
are write-only.
When you pass optimized_write=True
to the Workbook
constructor, openpyxl will use DumpWorksheet
class instead of Worksheet
. DumpWorksheet
class is very limited in terms of styling and formatting.
But, look at append method - it matches the python type of data you pass to excel types. So, see correct cell formats in the result file after running this:
import datetime
from openpyxl import Workbook
wb = Workbook(optimized_write=True)
ws = wb.create_sheet()
for irow in xrange(5):
ws.append([True, datetime.datetime.now(), 'test', 1, 1.25, '=D1+E1'])
wb.save('output.xlsx')
Speaking about changing the column headers style - just no way to do it using optimized writer.
Hope that helps.