to formula that calculates the sum of values in cells to you can see this in action in figure - figure - cell contains the formula =sum( : )which adds the cells to an excel formula is set just like any other text value in cell enter the following into the interactive shellimport openpyxl wb openpyxl workbook(sheet wb active sheet[' ' sheet[' ' sheet[' ''=sum( : )set the formula wb save('writeformula xlsx'the cells in and are set to and respectively the value in cell is set to formula that sums the values in and when the spreadsheet is opened in excela will display its value as excel formulas offer level of programmability for spreadsheets but can quickly become unmanageable for complicated tasks for exampleeven if you're deeply familiar with excel formulasit' headache to try to decipher what =iferror(trim(if(len(vlookup( sheet !$ $ :$ $ false))> ,substitute(vlookup( sheet !$ $ :$ $ false)"""),""))""actually does python code is much more readable adjusting rows and columns in exceladjusting the sizes of rows and columns is as easy as clicking and dragging the edges of row or column header but if you need to set row