이것은 내가 작성한 기능으로 지정된 셀/행/열이 편집 될 때마다 누군가에게 알리는 이메일을 보내고 onEdit을 트리거하도록 설정했습니다. 있는 그대로 작동합니다.Google 스프레드 시트 기능은 하나의 시트가 아닌 모든 시트에서 데이터를 가져옵니다.
/* This function send an email when a specified range is edited
* The spreadsheets triggers must be set to onEdit for the function
*/
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 = "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 == 1, 2)
{
//check for row to trigger
if (cellrow == 1)
{
//Send the Email
MailApp.sendEmail(recipients, subject, body);
}
//End sendNotification
}
}
내 문제는 내가 아니라 스프레드 시트 내에서 시트의에서 열 X보다에만 열 일하거나 편집 할 스프레드 시트의 특정 시트 (페이지)에 행이 필요하다는 것입니다.
아이디어가 있으십니까? 내가 놓쳤던 것이 단순한 것이기를 희망하지만 해결책을 찾지 못했습니다.
잘 처리했습니다. 내가 찾은 다른 해결책은이 코드 라인이었습니다. if (event.source.getActiveSheet(). getName() == "SheetIWant") – jredeker