Created
December 1, 2017 20:49
-
-
Save Toshakins/1ae56a2ae6fc31effc12a6532d95e0d4 to your computer and use it in GitHub Desktop.
Spreadsheet notifications
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function sendEmails() { | |
var sheet = SpreadsheetApp.getActiveSheet(); | |
var startRow = 2; // First row of data to process | |
var numRows = 50; // Number of rows to process | |
// Fetch the range of cells A2:B50 | |
var dataRange = sheet.getRange(startRow, 1, numRows, 2) | |
// Fetch values for each row in the Range. | |
var data = dataRange.getValues(); | |
for (i in data) { | |
var row = data[i]; | |
var name = row[0]; // First column | |
var amount = row[1]; // Second column | |
if (amount < 0 && name ==='Антон Овінніков') { | |
var subject = "Кинь грошей на обід"; | |
MailApp.sendEmail("anton.ovinnikov@devrecords.com", subject, ""); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment