from openpyxl import load_workbook path = 'valami.xlsx' wb = load_workbook(path) sheet = wb.worksheets[0] sheet['a1'] = 25 sheet['a2'] = 42 sheet['a3'] = 15 sheet['a4'] = '=sum(a1:a3)' wb.save(path)