I am trying to learn how to use google scripts. I found this script online and am trying to modify it to fit my needs but it's going very slowly. Can someone clarify a few things for me?
function Initialize() { var triggers = ScriptApp.getProjectTriggers(); for (var i in triggers) ScriptApp.deleteTrigger(triggers[i]); //1. why do the triggers need to be deleted? ScriptApp.newTrigger("SendGoogleForm") .forSpreadsheet(SpreadsheetApp.getActiveSpreadsheet()) .onFormSubmit().create(); //2. what does this do? } function SendGoogleForm(e) { if (MailApp.getRemainingDailyQuota() < 1) return; var email = "email@mail.com"; var subject = "Google Form Submitted"; var s = SpreadsheetApp.getActiveSheet(); var columns = s.getRange(1, 1, 1, s.getLastColumn()).getValues()[0]; var message = ""; for (var keys in columns) { var key = columns[keys]; if (e.namedValues[key] && (e.namedValues[key] !== "")) { message += key + ' :: ' + e.namedValues[key] + "\n\n"; } } //3. how do keys work? MailApp.sendEmail(email, subject, message); }
I am trying to add a way to send a second e-mail to a user supplied address.
Epic visual tool
Epson 5030UB 2D/3D 1080p 3LCD Projector Submitted September 17, 2015 at 04:19PM by theITknight http://ift.tt/1MerZTY
No comments:
Post a Comment