데이터 유효성이 검사 된 열을 변경하면 onEdit이 트리거되는지 테스트하기 위해이 작은 함수를 사용했습니다.
function sendSomething(e) {
var ts=Utilities.formatDate(new Date(), Session.getScriptTimeZone(), "MM:dd:yyyy HH:mm:ss");
var desc='This is an onEdit Trigger';
e.source.getSheetByName('Logger').appendRow([ts,desc]);
if(e.source.getActiveSheet().getName()=='RowAndCols' && e.range.getColumn()==2){
e.source.getSheetByName('Logger').appendRow([ts,'this is the edit from RowAndCols','Current Value is ' + e.value,'Row = ' + e.range.getRow()]);
}
}
제 경우에는 이름이 지정된 범위를 Yes No 대체와 Validated ColumnB로 사용했습니다.
로거 시트의 출력물입니다.
12:15:2017 11:22:49 this is the edit from RowAndCols Current Value is Yes
12:15:2017 11:22:51 This is an onEdit Trigger
12:15:2017 11:22:51 this is the edit from RowAndCols Current Value is No
12:15:2017 11:22:53 This is an onEdit Trigger
12:15:2017 11:22:53 this is the edit from RowAndCols Current Value is Yes
12:15:2017 11:22:56 This is an onEdit Trigger
12:15:2017 11:22:56 this is the edit from RowAndCols Current Value is No
12:15:2017 11:22:58 This is an onEdit Trigger
12:15:2017 11:22:58 this is the edit from RowAndCols Current Value is Yes
12:15:2017 11:23:59 This is an onEdit Trigger
12:15:2017 11:23:59 this is the edit from RowAndCols Current Value is Yes Row = 5
12:15:2017 11:24:00 This is an onEdit Trigger
12:15:2017 11:24:00 this is the edit from RowAndCols Current Value is No Row = 6
12:15:2017 11:24:02 This is an onEdit Trigger
12:15:2017 11:24:02 this is the edit from RowAndCols Current Value is Yes Row = 7
12:15:2017 11:24:04 This is an onEdit Trigger
12:15:2017 11:24:04 this is the edit from RowAndCols Current Value is No Row = 8
내 시트의 이름은 RowAndCols이었고, 내 로거 시트의 이름은 로거했다.
그리고 제대로 작동하는 것 같습니다.
onEdit 트리거를 사용하고 있습니까? 즉각적인 알림을 위해 설정할 수 있으며 코드에서 실행되는 모든 오류를 사용자에게 보냅니다. – Cooper
위에서 언급 한 onEdit 트리거를 사용하고 있습니다. 나는 즉각적인 통보를 받았으며 아직 어떤 실패 통지도받지 못하고있다. 그래서 나는 방아쇠 자체가 문제인지 궁금해하고있다. –
그럼 그냥 삭제하고 다시 만들어보십시오. 또한 시트 중 하나를 사용하여 트리거 로그를 작성하고 트리거가 발생할 때마다 타임 스탬프가있는 행을 추가 할 수 있습니다. if 문을 열기 전에 입력해야합니다. – Cooper