Copy Google Sheet with App Script, retaining comments

匿名 (未验证) 提交于 2019-12-03 01:36:02

问题:

I am trying to copy a Google Sheet while retaining all the comments (which are associated with cells), following this.

Everything works fine until the line Drive.Comments.insert(item, documentId).commentId

An error saying:

Anchor is missing required property root.r`

appeared.

Has anyone tried doing so, and could you enlighten me on what's wrong?

My attempt

  1. I tried to look deeper into the Google Drive APIs, the example they gave is only for "document-level comment", and allows no where for the anchor to be input.

  2. The second answer here claims that it is impossible to attach programmatically the comment to a cell, because the anchors for Spreadsheet Comments are proprietary. This seems to contradict with the first link (unless the first link only talks about document wide comments)

  3. Seems like setting comments in Google Sheet have been requested for a long time, yet it hasn't been implemented. (here and here) So using the Drive API seems to be the only way to insert comment.

Any help is highly appreciated!

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!