def writeProgramCellsForYear(ws, row, program: Program, year): startCol = monthStartOutput + (year - startYear) * colsPerYear values = program.getMonthDict(year) lastMonth = 12 if year == lastYearData and lastMonthData < lastMonth: lastMonth = lastMonthData for month in range(1, lastMonth + 1): ws[get_column_letter(startCol + month - 1) + str(row)] = values[month - 1]['numEvents'] ws[get_column_letter(startCol + month - 1) + str(row + 1)] = values[month - 1]['numPeopleUnique'] ws[get_column_letter(startCol + month - 1) + str(row + 2)] = values[month - 1]['numPeople']