I already have a script in place that sends out a notification when a new cell has been added to my spreadsheet. However, it only runs when I trigger it (through code editor) and does not run in the background. Essentially, I want to have this script run when something new is added to the spreadsheet, however, I'm unsure If this can be accomplished?
function sendNotification() {
var ss = SpreadsheetApp.getActiveSpreadsheet();
var sheet = ss.getActiveSheet();
//Get Active cell
var mycell = ss.getActiveSelection();
var cellcol = mycell.getColumn();
var cellrow = mycell.getRow();
//Define Notification Details
var recipients = "[email protected]";
var subject = "THIS IS A TEST - Please Ignore "+ss.getName();
var body = ss.getName() + " has been updated. Visit " + ss.getUrl() + " to view the changes.";
//Check to see if column is A or B to trigger
if (cellcol == 1)
{
//Send the Email
MailApp.sendEmail(recipients, subject, body);
}
//End sendNotification
}
Thank you!