Comments
Documentation
setComments
Add or remove cell comments. The body is keyed by cell name: each field name is a cell reference (for example A1) and its value is the comment. In a thread, comments and date are required; user_id, name and edited are optional.
| Parameter | Description |
|---|---|
<cellName> |
The comment for that cell: a string note, or a thread array ([i][comments], [i][date], optional [i][user_id], [i][name], [i][edited]). Empty string removes the comment. |
POST /api/:guid/:worksheetIndex/comments
getComments
Get the comments from a cell.
| Parameter | Description |
|---|---|
cellNames |
Cell names and/or ranges. |
GET /api/:guid/:worksheetIndex/comments/:cellNames
Examples
Set comments
Add a note to cell A1 and a comment to cell B3.
const baseUrl = 'https://your-server.example.com/api';
const guid = '79b45919-c751-4e2b-a49a-6c1286e2fc03';
const headers = { 'Authorization': `Bearer ${token}` };
// Set new comments
await fetch(`${baseUrl}/${guid}/0/comments`, {
method: 'POST',
headers,
body: new URLSearchParams({
'A1': 'first comment',
'B3[0][comments]': 'Something',
'B3[0][date]': new Date().toISOString(),
'B3[0][name]': 'Random name',
}),
});
Get comments from a cell
const baseUrl = 'https://your-server.example.com/api';
const guid = '79b45919-c751-4e2b-a49a-6c1286e2fc03';
const headers = { 'Authorization': `Bearer ${token}` };
// Get comments from A1 - You can use D1:D4 or A1,A2,A3 for multiple cells
const comments = await (await fetch(`${baseUrl}/${guid}/0/comments/A1`, { headers })).json();
console.log(comments);