1

I want to update the 'displayName' and 'email' of commenters within Google Sheet using 'Spreadsheet' Service along with 'Drive' service.

I have used both Drive.comments.patch(comments, fileId, commentID), Drive.comments.patch(comments, fileId, commentID) to achieve the same, The script runs successfully but no effect within the google sheets and doesn't change anything of comment

function maskComment() {
  var currentSpreadsheet = SpreadsheetApp.getActiveSpreadsheet();
  var FileID =currentSpreadsheet.getId()
  var commentsList = Drive.Comments.list(FileID)

  //No effect in any of this, however the debugger lists both setDisplayName and setEmailAddress 
  commentsList.items[0].author.setDisplayName("company user"); 
  commentsList.items[0].author.setEmailAddress('test@mycompany.com');

  //No effect in any of this but code runs successfully
  Drive.Comments.patch(commentsList.items[0], FileID, commentsList.items[0].commentId) //or Drive.Comments.update(commentsList.items[0], FileID, commentsList.items[0].commentId)  No
}

I will appreciate any further information regarding changing 'email' and 'display name' of commenter within Google Sheets.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.