variable you then assign that variable to cell object' font attribute for examplethis code creates various font stylesimport openpyxl from openpyxl styles import font wb openpyxl workbook(sheet wb['sheet'fontobj font(name='times new roman'bold=truesheet[' 'font fontobj sheet[' ''bold times new romanfontobj font(size= italic=truesheet[' 'font fontobj sheet[' '' pt italicwb save('styles xlsx'herewe store font object in fontobj and then set the cell object' font attribute to fontobj we repeat the process with another font object to set the font of second cell after you run this codethe styles of the and cells in the spreadsheet will be set to custom font stylesas shown in figure - figure - spreadsheet with custom font styles for cell we set the font name to 'times new romanand set bold to trueso our text appears in bold times new roman we didn' specify sizeso the openpyxl default is used in cell our text is italicwith size of we didn' specify font nameso the openpyxl defaultcalibriis used formulas excel formulaswhich begin with an equal signcan configure cells to contain values calculated from other cells in this sectionyou'll use the openpyxl module to programmatically add formulas to cellsjust like any normal value for examplesheet[' ''=sum( : )working with excel spreadsheets