Google Apps 脚本:尝试在单元格中放置注释时出现"Range is not a function, it is object"错误



运行脚本后,我试图在所选行的第一个单元格中放置注释。我用这个代码来做这件事:

  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);

相关内容

最新更新