How to get a note or comment

爱⌒轻易说出口 提交于 2019-11-29 15:19:15
Mogsdad

The Google Apps Spreadsheet API only provides programmatic access to spreadsheet data. You cannot access comments using the API.

You can get the Notes for a cell or range of cells using Google Apps Script. See the Class Range documentation for these methods:

  • getNote() - Returns the note associated with the given cell.
  • getNotes() - Returns the notes associated with the cells in the range.

There are open issues related to this functionality, mainly concerning comments (the "other" type of note). See Issue 1818 and Issue 2566

In a comment on your question, SGC asks if you've looked at developers.google.com/drive/v2/reference/comments/get and developers.google.com/drive/v2/reference/comments/list; these are FILE level comments, not the comments attached to a spreadsheet cell.

1 - Add the following custom function to your spreadsheet (through the Tools -> Script Editor menu)

function getNote(cell) {
return SpreadsheetApp.getActiveSheet().getRange(cell).getComment()
}

2 - on your spreadsheet use the following formula to get contents

=getNote(cell("address",a1))

or

=getNote(cell("address",E9),GoogleClock())

if your comments are not static.

Nick_Jo

Bit of a muck around but it's possible to download the googlesheet as a .xlsx file, which, with varying degrees of success, converts the comments into Excel comments.

Uploading this xslx file converts the comments to notes!

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