I have a column with certain text that I use for signals. When a cell value in the column has the text "Signal1" or "Singal2" then send email with title that "Signals were found". When scanning the column any other cell expect for "Signal1" or "Signal2" can be ignored.
This is what I have so far but it's only for one cell one signal:
function CheckSignals() {
// Fetch data
var dataRange = SpreadsheetApp.getActiveSpreadsheet().getSheetByName("Signal").getRange("H2:H29");
var data = dataRange.getValue();
// Check for signals
if (data = "Go Short" || "Go Long"){
// Fetch the email address and send
var emailRange = SpreadsheetApp.getActiveSpreadsheet().getSheetByName("Email").getRange("C2");
var emailAddress = emailRange.getValues();
// Send Alert Email.
var message = 'Signal1 ' + data; // Second column
var subject = 'Signals were found';
MailApp.sendEmail(emailAddress, subject, message);
}
}
This is working but it's too simple... There are two signals I have to scan for in the column: "Singal1" and "Signal2".
For example, if column H was scanned three "Signal1" and/or "Signal2" was found. The email content should contain information from the whole row for each cell where it was found.
Example email:
Subject: Signals was found
Message:
Signal 1 was found in the following rows with the following data: Row6: data from row 6 column A, data from row 6 column B,data from row 6 column C,data from row 6 column D, ...up to column H
Row11: Brown, Denver, 23, 1967, 11:00, 34, etc...
The spreadsheet always have 29 rows, where the first row is headers. The spreadsheet has 9 columns (A - H).