Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function priceAlert(){
- const ss = SpreadsheetApp.getActiveSpreadsheet();
- const summary = ss.getSheetByName('Summary');
- const email = summary.getRange('P3').getValue();
- const columnAValues = summary.getRange(5, 1, summary.getLastRow()).getValues().flat();
- const values = summary.getRange(5, 26, summary.getLastRow(), 3).getValues();
- for(i = 0; i < values.length; i++){
- const row = values[i];
- if(row[2] == true){
- console.log(`Found true value: ${columnAValues[0]} | ${row[0]} | ${row[1]}`);
- summary.getRange(5 + i, 16).clearContent();
- sendMail(email, columnAValues[i], row[0], row[1]);
- }
- }
- }
- function sendMail(email, a, z, aa){
- const subject = `${a} has reached your ${aa} target at ${z}`;
- GmailApp.sendEmail(email, subject, '');
- console.log(`## Send email: ${a} | ${z} | ${aa} ##`);
- }
Add Comment
Please, Sign In to add comment