Google Sheets Automation Using Google Apps Script

//Get the data starting from values (i.e. skip the header row)var data=    responses.getRange(2,1,responses.getLastRow()-1,6).getValues();Logger.log(data);
//Iterate each row of datadata.forEach(function(row, i) {// variablesvar Marks = row[1]; // marks secured by the studentsvar Name  = row[2]; // Name of the studentvar Email_ID = row[3];// Email address of the studentvar Roll_no  = row[4]; // Roll number of the student
function formatEmailBody(Rating, Name, Marks,Email_ID,Roll_no) {var emailTxt = "Teachers remarks: " + Rating + "<br><br>" +" Name           :  "  + Name      + "<br><br>"   +" Score          :  "  + Marks     + "<br><br>"   +" Email Address  :  "  + Email_ID  + "<br><br>"   +" Roll Number    :  " + Roll_no   +  "<br><br>";return emailTxt;}
if (Marks <= 10){// send an email for marks less than equal to 10var body =  formatEmailBody("Bad",Name, Marks,Email_ID,Roll_no);}else if (Marks <10) {// send an email for marks greater than 10var body =  formatEmailBody("Moderate",Name,Marks,Email_ID,Roll_no);}else if (Marks <= 15) {// send an email for marks greater than equal to 15var body =  formatEmailBody("good",Name, Marks,Email_ID,Roll_no);}
else if (Marks <= 20) {// send an email for the rating 2var body = formatEmailBody("Very Good",Name,Marks,Email_ID,Roll_no);}
else if (Marks <= 25) {// send an email for marks greater than equal to 25var body = formatEmailBody("Great",Name, Marks,Email_ID,Roll_no);}

Currently pursuing B Tech at MPSTME. Technical Blogger, interested in Google Workspace. Hope to remain a life long student. Created a course on Google Classroom

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store