Comments
Manage the cell comments of your online spreadsheets using the following routes.
Documentation
Available routes for cell comments management.
setComments
Add or remove comments from a spreadsheet cell. The request body is keyed directly by cell name: each field name is a cell reference (for example A1), and its value is the comment. A plain string sets a simple note; a thread is an array of objects with comments and date required and user_id, name and edited optional. An empty string removes the current comment for that cell.
| 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 |
cells and/or comments whose comment should be returned. |
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
It is possible get the comments from multiple cells using comma or a range, such as D1:D4.
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);