Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR TYPESCRIPT

google sheets loops with if statement

function Loop3(){
  let ss= SpreadsheetApp.getActiveSpreadsheet().getSheetByName('Order')
  let EndRow= ss.getLastRow()
  Logger.log(EndRow)

  for(i=2;i<EndRow;i++){
   let cost= ss.getRange(i,4).getValue()
   let ship1= 10;
   let ship2= 5

   if(ss.getRange(i,1).getValue()=="Branch 2"){
     ss.getRange(i,5).setValue(ship1);
     ss.getRange(i,6).setValue(ship1+cost)
   } else {
     ss.getRange(i,5).setValue(ship2);
     ss.getRange(i,6).setValue(ship2+cost)
   }
  }
}
 
PREVIOUS NEXT
Tagged: #google #sheets #loops #statement
ADD COMMENT
Topic
Name
6+5 =