Q:

Change font style in openpyxl

Hi I am working on setting the font style to automate the stuff and I can't get the results I want. I want to change the font of column A but I cannot find the correct command for it. Thanks for your time!
import openpyxl
from openpyxl.styles import Font

wb = openpyxl.Workbook()
sheet = wb["Sheet"]
italic24Font = Font( size = 24, italic = True)
sheet['A']  #I do not know the command here
wb.save( 'test.xlsx' )

A:

You can use font attribute of worksheet column, something like this:
>>> my_col = sheet.column_dimensions['A']
>>> my_col.font = italic24Font

But, note that this applies only to cells created (in Excel). If you want to apply styles to entire column then you must apply the style to each cell by iteration.

