Spreadsheet Data
Get and set data to and from your online spreadsheets.
Documentation
The following methods are available to interact with the spreadsheet data programmatically.
getData
Get the data from the worksheet
GET /api/:guid/:worksheetIndex/data
setData
Set a new data for your worksheet
| Parameter | Description |
|---|---|
data |
new data |
POST /api/:guid/:worksheetIndex/data
Examples
Get the spreadsheet data
The following example show how to get the data from a worksheet.
const baseUrl = 'http://localhost:8009/api';
const token = 'eyJhbGciOiJIUzUxMiIsInR5cCJ9.eyJkb21haW4iOiJsb2NhbGhvc3Q6ODAPQSJ9.Xr2Ir2-zEc_tqV5y6i';
const guid = '79b45919-c751-4e2b-a49a-6c1286e2fc03';
const headers = { 'Authorization': `Bearer ${token}` };
// Get the data from worksheet 0
const data = await (await fetch(`${baseUrl}/${guid}/0/data`, { headers })).json();
console.log(data);
Set the spreadsheet data
The following example show how to update the data from a worksheet.
const baseUrl = 'http://localhost:8009/api';
const token = 'eyJhbGciOiJIUzUxMiIsInR5cCJ9.eyJkb21haW4iOiJsb2NhbGhvc3Q6ODAPQSJ9.Xr2Ir2-zEc_tqV5y6i';
const guid = '79b45919-c751-4e2b-a49a-6c1286e2fc03';
const headers = { 'Authorization': `Bearer ${token}` };
// Set the data of worksheet 0 to a single row: ["1", "2", "3"]
await fetch(`${baseUrl}/${guid}/0/data`, {
method: 'POST',
headers,
body: new URLSearchParams({
'data[0][0]': '1',
'data[0][1]': '2',
'data[0][2]': '3',
}),
});