运行脚本后,我试图在所选行的第一个单元格中放置注释。我用这个代码来做这件事:
var sheet = SpreadsheetApp.getActiveSheet();
var activeCell = sheet.getActiveCell();
var firstCell = activeCell.offset(0, 1-activeCell.getColumn());
firstCell().setComment(docName);
(其中docName
是字符串)但是,我收到了以下错误消息:TypeError: Range is not a function, it is object.
我该怎么修?
错误消息是显式的。。。firstCell是一个范围对象,不应该使用括号。
尝试如下:firstCell.setComment(docName);