2

Google docs comment:

enter image description here

My goal is to add a text-specific comment using Google Apps Script as seen in the picture above. Right now I have this working code, but it only adds a general comment for the whole document.

function myFunction() {
  var fileId = '{FILE_ID}';
  var resource = {'content': 'comment body text'};
  Drive.Comments.insert(resource, name);
}
AL.
  • 36,815
  • 10
  • 142
  • 281

1 Answers1

2

Not possible. In this video -- Google Drive SDK: Announcing the Comments API (5:30 - 5:39) -- it is mentioned that:

..We do have a proprietary anchoring scheme, which does make it difficult for, or actually rather impossible for you to create comments that are anchored to text in our document formats...

"in our document formats" refers to Google Docs and Sheets.

This is also mentioned in this answer. For more details regarding Comments, you can check the Manage Comments and Discussions documentation.

Community
  • 1
  • 1
AL.
  • 36,815
  • 10
  • 142
  • 281