lundi 23 juin 2014

Google sheets script that sends a notification upon form submission if data is recorded in a specific column


Vote count:

0




I'm trying to create a script for new google sheets that sends a notification if a form is submitted and contains data in a specific column.


In this example, if the question that populates data in column E is answered in the form, I would like an email notification with a link to the spreadsheet.


In the below script, if I set the trigger to on edit it will work if column E is edited. I cannot get it to work with on form submit, however. Can anyone help with fixing this script to work on edit?


Thanks!



function sendNotification() {
var ss = SpreadsheetApp.getActiveSpreadsheet();
var sheet = ss.getSheetByName("Form Responses");
var cell = ss.getActiveCell().getA1Notation();
var row = sheet.getActiveRange().getRow();
var cellvalue = ss.getActiveCell().getValue().toString();
var recipients = "email@email.com";
var subject = 'subject';
var body = 'body';
if (cell.indexOf('E')!=-1)
{
MailApp.sendEmail(recipients, subject, body);
}


asked 33 secs ago






Aucun commentaire:

Enregistrer un commentaire