dimanche 27 juin 2021

If else function not consistently working

I cannot get this if/else to replace more than one row of of the column at a time. I have tried

spreadSheet.getRange(2, 38, 4000)

spreadSheet.getRange(2, 38, spreadSheet.getLastRow()-1)

and

spreadSheet.getRange(2, 38, sheet.getMaxRows())

It's not returning anything if it's not set up like below (and that only returns one cell.

function calculateHitPoints(){
var spreadSheet = SpreadsheetApp.getActiveSpreadsheet().getSheetByName("Form Responses 1");
var setHP = spreadSheet.getRange(2, 38).getValues();

if(setHP == "Fighter"){
spreadSheet.getRange(2, 38).setValue("14");
}
else if(setHP == "Ranger"){
spreadSheet.getRange(2, 38).setValue("13");
}

}

Aucun commentaire:

Enregistrer un commentaire