If Statements in Google Script

If statements in google script are relatively similar to those in python in that it is a conditional statement. It is different however in that there is no need to write then to complete the conditional statement. In python you have to right a if statement and a then statement which concludes the conditional statement. In script you write the if statement and just follow it up with the action you want to take place if the condition is met.

Below: This code is a conditional statement that I practiced using to sort my data.

Screen Shot 2016-05-11 at 7.58.37 am




This program if run would read the variable cellD2 and if the value in that cell was 9 then it would go to sheet “G9” and set the value of cell D2 on sheet “G9” to 9. This code is quite basic, but I can get it to read a range and move the whole rows of data to other sheets. Which would organise the data receive from the form into grade levels.

Leave a Reply