mardi 23 avril 2019

Append values in single cell using openpyxl

I have a below code which writes some error in column 8 of a same row whenever if condition fails. I have 3 if conditions and all of them write a different error in column 8. The problem is that each sheet.cell(row = i, column = 8).value statement overwrites the previous error. How can i append the errors in same cell?

      if math_value_of_aufloesung_in_A2L == math_value_of_aufloesung_in_Excel:
        sheet.cell(row = i, column = 3).fill = reportParameters.fillCellColor(reportParameters.colorforMatch)
      else:
        sheet.cell(row = i, column = 8).value = reportParameters.errorType5
        bewertung=1

      if math_value_of_min_wert_in_A2L == math_value_of_min_wert_in_Excel:
        sheet.cell(row = i, column = 5).fill = reportParameters.fillCellColor(reportParameters.colorforMatch)
      else:
        sheet.cell(row = i, column = 8).value = reportParameters.errorType6
        bewertung=1

      if math_value_of_max_wert_in_A2L == math_value_of_max_wert_in_Excel:
        sheet.cell(row = i, column = 7).fill = reportParameters.fillCellColor(reportParameters.colorforMatch)
      else:
        sheet.cell(row = i, column = 8).value = reportParameters.errorType7
        bewertung=1

Aucun commentaire:

Enregistrer un commentaire