javascript - Send an Email to a Static Email Address based on a Trigger Word in a Column of a Google Spreadsheet -
i have following code, 'if' argument send 'message' array doesn't seem execute every row has alert text in col[19]. rather, 1 email being sent each time script run, though there several alerts in col[19].
function analyzealerts() { var sheet = spreadsheetapp.getactivesheet(); var startrow = 4; // first row of data process var numrows = 30; // number of rows process // fetch range of cells a2:b3 var datarange = sheet.getrange(startrow, 1, numrows, 30) // fetch values each row in range. var data = datarange.getvalues(); (i in data) { var col = data[i]; var subject = "upcoming bill alerts"; var message = "the bill "+col[13]+" invoice #:"+col[11]+" $"+col[12]+" due on "+col[14]; if (col[19]="alert") { mailapp.sendemail("hello@world.com", subject, message); } } }
Comments
Post a Comment