Is it possible to add a comment to a cell in a Google Sheet using Google Sheet API ? I have searched https://developers.google.com/sheets/api/, but found no command that does this.
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
回答1:
Yes. You can add a comment to a cell. But "comment" is used as "note" at Sheets API. You can add "note" using spreadsheets.batchUpdate of Sheets API.
The endpoint and sample request body is as follows.
Endpoint :
POST https://sheets.googleapis.com/v4/spreadsheets/### Spreadsheet ID ###:batchUpdate
Sample request body :
{
"requests": [
{
"updateCells": {
"range": {
"sheetId": ### sheetId ###,
"startRowIndex": 0,
"endRowIndex": 1,
"startColumnIndex": 0,
"endColumnIndex": 1
},
"rows": [
{
"values": [
{
"note": "sample note"
}
]
}
],
"fields": "note" // You can also use ``*``.
}
}
]
}
Note :
- Please add the cell coordinates as GridRange.
"startRowIndex": 0, "endRowIndex": 1, "startColumnIndex": 0, "endColumnIndex": 1
is "A1".
Reference :
- CellData
- GridRange
If this was not what you want, I'm sorry.