我试图让一个脚本仅在有人编辑特定列以发送自动电子邮件通知时才查看特定的选项卡/页面。但是,它将在所有选项卡上发送有关任何编辑的电子邮件通知。如何指定工作表:“ CT-培训”
function sendNotification() {
var ss = SpreadsheetApp.getActiveSpreadsheet();
var sheet = activeSpreadsheet.getSheetByName('CT - Training');
//Get Active cell
var mycell = ss.getActiveSelection();
var cellcol = mycell.getColumn();
var cellrow = mycell.getRow();
//Define Notification Details
var recipients = "email@email.email";
var subject = "Update to "+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 == 17);
//Check to see if column is A or B to trigger
if (cellcol == 20);
{
//Send the Email
MailApp.sendEmail(recipients, subject, body);
}
//End sendNotification
}