如何使用 google sheet 应用程序脚本在单元格上添加评论

How Can I add comment on a cell using google sheet app script

如何使用应用程序脚本向 google sheet 添加评论。我可以添加注释,但我想添加评论。尝试了不同的方法,但没有线索。

.setcomments

.getcomments

功能甚至不存在。

我想添加评论:

function insertDriveComment(){
  var fileId = 'your file id'
  var resource = {'content': 'Here is my comment !'};
  Drive.Comments.insert(resource, fileId)
}

您必须启用 Drive API 服务

或者,如果您使用同一个电子表格添加评论

function insertDriveComment(){
  var fileId = SpreadsheetApp.getActiveSpreadsheet().getId()
  var resource = {'content': 'Here is my comment !'};
  Drive.Comments.insert(resource, fileId)
}

启用驱动器 api 服务