Skip to content

Instantly share code, notes, and snippets.

@Toshakins
Created December 1, 2017 20:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Toshakins/1ae56a2ae6fc31effc12a6532d95e0d4 to your computer and use it in GitHub Desktop.
Save Toshakins/1ae56a2ae6fc31effc12a6532d95e0d4 to your computer and use it in GitHub Desktop.
Spreadsheet notifications
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