After studying your question, I assume the following:
- You want to check a column matching the string
E60
.
- When a cell with
E60
is found, your want to send a email with the full row content.
If my assumptions are correct, you can use the following example to fulfill your requests:
CODE
function E60Alert() {
var sheet = SpreadsheetApp.openById(
'{SPREADSHEET ID}').getSheetByName('Sheet1');
var lastRow = sheet.getLastRow();
var lastColumn = sheet.getLastColumn();
var subject = "E60 Alert";
var email = "{YOUR EMAIL}";
var rowContent = sheet.getRange(1, 1, lastRow, lastColumn).getValues();
for (var i = 1; i <= lastRow; i++) {
if (rowContent[i - 1][4] == 'E60') {
MailApp.sendEmail(email, subject, rowContent[i - 1]);
}
}
}
BEHAVIOUR
That code will first read the full table. After that, it will iterate it searching for the desired string (E60
in this case). If it finds it, it will send an email with the full row content.
OBSERVATIONS
- This code will run on demand by clicking the
Run
button.
- You will have to edit the
if (rowContent[i - 1][4] == 'E60') {
line to match the desired column of the data. I chose the fifth column (number 4) for testing purposes.
ALLUSIONS
Please take this as one of the possible solutions to your issue, and don't hesitate to write me back with any additional doubts or requests to further clarifications.