Google Script Sheet that sends email from a predefined date -
i new coding , trying create little programme iterates on google sheet , finds integer "location number - 486." then, number generate e-mail address each location. info remains same on each e-mail mgr###@company.com. thing changes location number. far have been able grab snippet google iterates on info , sends e-mail looking function or whatever phone call in in gscripts generates email each location , sends email each newly generated address.
any help, advice or ideas appreciated. said, i'm new coding bur understand basics of how programming works.
bellow gscript snippet using task.
thanks in advance guys.
class="lang-js prettyprint-override">// constant written in column c rows email // has been sent successfully. var email_sent = "email_sent"; function sendemails2() { var sheet = spreadsheetapp.getactivesheet(); var startrow = 2; // first row of info process var numrows = 2; // number of rows process // fetch range of cells a2:b3 var datarange = sheet.getrange(startrow, 1, numrows, 3) // fetch values each row in range. var info = datarange.getvalues(); (var = 0; < data.length; ++i) { var row = data[i]; var emailaddress = row[0]; // first column var message = row[1]; // sec column var emailsent = row[2]; // 3rd column if (emailsent != email_sent) { // prevents sending duplicates var subject = "sending emails spreadsheet"; mailapp.sendemail(emailaddress, subject, message); sheet.getrange(startrow + i, 3).setvalue(email_sent); // create sure cell updated right away in case script interrupted spreadsheetapp.flush(); } } }
google-apps-script google-spreadsheet
No comments:
Post a Comment