1

我正在尝试将注释与单元格值一起导入。我正在使用 importRage() 作为值。我还发现了以下应该获得评论的 Google Apps 脚本:

    function importComments(spreadsheetKey,a1NotationReference) {
      return SpreadsheetApp.openById(spreadsheetKey).getRange(a1NotationReference).getComments();
    }

但是,每次运行它时,我都会收到“缺少形式参数”错误。

我也试过这样运行它,但没有运气/

    function importComments(0AqvTp4ajjRSUdHYyV09QcWtnRFQ2SDUwSTF6OTBKQ0E,Overall!B2:I2) {
      return SpreadsheetApp.openById(0AqvTp4ajjRSUdHYyV09QcWtnRFQ2SDUwSTF6OTBKQ0E).getRange(Overall!B2:I2).getComments();
    };

任何帮助,将不胜感激!

4

1 回答 1

0

您没有正确调用该函数,以下是您添加到 Google 脚本管理器的内容。这不需要更改。

function importComments(spreadsheetKey,a1NotationReference) {
      return SpreadsheetApp.openById(spreadsheetKey).getRange(a1NotationReference).getComments();
    }

然后,您可以使用以下函数在电子表格中调用它。只需像普通的电子表格方程式一样输入单元格。

=importComments("0AqvTp4ajjRSUdHYyV09QcWtnRFQ2SDUwSTF6OTBKQ0E", "Overall!B2:I2")

正如 Google 论坛上的 Henrique Abreu 所提到的,这与 importRange 非常相似。请查看此页面以了解其用法,因为它将有助于 importComments。

编辑两者的例子......未经测试

function importBoth(spreadsheetKey,a1NotationReference){
   return SpreadsheetApp.openById(spreadsheetKey).getRange(a1NotationReference).getComments();
   return SpreadsheetApp.openById(spreadsheetKey).getRange(a1NotationReference).getValue();
}
于 2013-04-14T10:04:03.150 回答