majid asad
majid asad

Reputation: 409

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

How Can I add comment to google sheet using app script. I can add notes but i want to add comments. tried different methods but no clue.

.setcomments

and

.getcomments

function not even exisit.

Upvotes: 0

Views: 214

Answers (1)

Mike Steelson
Mike Steelson

Reputation: 15318

I achive to add a comment with :

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

you have to enable Drive API service

or, if you use the same spreadsheet to add comments

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

to enable drive api service enter image description here

Upvotes: 2

Related Questions