如果对数据验证设置为拒绝无效数据输入的单元格进行了错误输入,我试图查看onEdit是否会激活。我无法使用onEdit工作,因此将函数修改为myonEdit并在工作表上设置通知。我得到了同样的结果。
我做错了吗?
function myonEdit() {
var mycell = SpreadsheetApp.getActiveSpreadsheet().getActiveCell().getA1Notation()
Logger.log('The cell edited was ' & mycell)
}
执行记录是:
[16-04-21 05:09:33:624 PDT] SpreadsheetApp.getActiveRange() [0 seconds]
[16-04-21 05:09:33:625 PDT] Range.getRow() [0 seconds]
[16-04-21 05:09:33:625 PDT] Range.getLastRow() [0 seconds]
[16-04-21 05:09:33:625 PDT] Range.getColumn() [0 seconds]
[16-04-21 05:09:33:625 PDT] Range.getLastColumn() [0 seconds]
[16-04-21 05:09:33:626 PDT] SpreadsheetApp.getActiveSpreadsheet() [0 seconds]
[16-04-21 05:09:33:714 PDT] Starting execution
[16-04-21 05:09:33:719 PDT] SpreadsheetApp.getActiveSpreadsheet() [0 seconds]
[16-04-21 05:09:33:720 PDT] Spreadsheet.getActiveCell() [0 seconds]
[16-04-21 05:09:33:720 PDT] Range.getA1Notation() [0 seconds]
[16-04-21 05:09:33:722 PDT] Logger.log([0.0, []]) [0 seconds]
[16-04-21 05:09:33:724 PDT] Execution succeeded [0.003 seconds total runtime]
但是包含的日志
[16-04-21 05:09:33:721 PDT] 0.0
我做得好吗?是否无法使用具有简单触发器的Logger?是否会因错误输入经过验证的单元格而激活onEdit事件?
答案 0 :(得分:0)
'&安培;'是javascript中的bitwise operator。使用' +'签署合并字符串:
Logger.log('The cell edited was ' + mycell)