mercredi 10 mars 2021

Hello everyone, please help me check this IF statement in Google app script

I want to make a code to assign logic input for my sheet. I use IF to make it. My code ran successfully but the logic didn't work. I have checked it many times, but I couldn't find something wrong. Can you help me with this? I'm stuck. Please review my example sheet and my script for more information. Thank you! https://docs.google.com/spreadsheets/d/1eV2SZ45Gs6jISgh_p6RIx-rfOGlHUM6vF114Mgf6c58/edit#gid=0

function logic(){
  var ss = SpreadsheetApp.getActiveSpreadsheet().getActiveSheet();
  var activeCell = ss.getActiveCell();

  if (activeCell.getColumn() == 1 && activeCell.getRow() > 1 && ss.getSheetName() == "mama" && activeCell.getValue() == "Yes") {
    activeCell.offset(0,1).clearContent();
    activeCell.offset(0,1).setValue("1");
  } if (activeCell.getColumn() == 1 && activeCell.getRow() > 1 && ss.getSheetName() == "mama" && activeCell.getValue() == "Hafl") {
    activeCell.offset(0,1).clearContent();
    activeCell.offset(0,1).setValue("1/2");
  } if (activeCell.getColumn() == 1 && activeCell.getRow() > 1 && ss.getSheetName() == "mama" && activeCell.getValue() == "No") {
    activeCell.offset(0,1).clearContent();
    activeCell.offset(0,1).setValue(0);
  }

} ```

Aucun commentaire:

Enregistrer un commentaire