Spreadsheet Data
Get and set the worksheet data.
Documentation
getData
Get the worksheet data.
GET /api/:guid/:worksheetIndex/data
setData
Replace the worksheet data.
| Parameter | Description |
|---|---|
data |
New data. |
POST /api/:guid/:worksheetIndex/data
Examples
Get the spreadsheet data
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
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',
}),
});