Spreadsheet Data

Get and set data to and from your online spreadsheets.

Documentation

Methods

The following methods are available to interact with the spreadsheet headers programmatically.
MethodDescription
getData Get the data from the worksheet
getData(): Promise<
{
id: string;
row: number;
data: string[];
}[]
>


GET /api/:guid/data
setData Set a new data for your worksheet
setData(
data: (
| string[]
| {
row: number;
data: string[];
}
)[]
): Promise<void>

@param data - new data

POST /api/:guid/data


Examples

Get the spreadsheet data

The following example show how to get the data from a worksheet.

NodeJS
PHP
import { Client } from '@jspreadsheet/client';

// Access token
const token = 'MSxlMjE2MWI5YWNjYTg2MzM4MThmN2Y4NjY0YmQzYzBlOGExMmVkZjVk';

// Spreadsheet Guid
const guid = '79b45919-c751-4e2b-a49a-6c1286e2fc03';

// Create a new client
const client = new Client(token);

// Get the spreadsheet instance
const spreadsheet = client.getSpreadsheet(guid);

// Request data
spreadsheet.getData().then((data) => {
    console.log(data);
});
<?php
require 'vendor/autoload.php';

use jspreadsheet\Jspreadsheet;

// Access token
$token = 'MSxlMjE2MWI5YWNjYTg2MzM4MThmN2Y4NjY0YmQzYzBlOGExMmVkZjVk';

// Spreadsheet Guid
$guid = '79b45919-c751-4e2b-a49a-6c1286e2fc03';

// Create a new client
$client = new Jspreadsheet($token);

// Get the spreadsheet instance
$spreadsheet = $client->getSpreadsheet($guid, 0); // 0 or null for the first worksheet

// Get the spreadsheet instance and request configuration
$result = $spreadsheet->getData();

print_r($result);


Set the spreadsheet data

The following example show how to update the data from a worksheet.

NodeJS
PHP
import { Client } from '@jspreadsheet/client';

// Access token
const token = 'MSxlMjE2MWI5YWNjYTg2MzM4MThmN2Y4NjY0YmQzYzBlOGExMmVkZjVk';

// Spreadsheet Guid
const guid = '79b45919-c751-4e2b-a49a-6c1286e2fc03';

// Create a new client
const client = new Client(token);

// Get the spreadsheet instance
const spreadsheet = client.getSpreadsheet(guid);

// Set Data
spreadsheet.setData([['1', '2', '3']]).then(() => {
    // It worked correctly
}).catch((err) => {
    // Something went wrong
    console.log(err);
});
<?php
use jspreadsheet\Jspreadsheet;

// Access token
$token = 'MSxlMjE2MWI5YWNjYTg2MzM4MThmN2Y4NjY0YmQzYzBlOGExMmVkZjVk';

// Spreadsheet Guid
$guid = '79b45919-c751-4e2b-a49a-6c1286e2fc03';

// Create a new client
$client = new Jspreadsheet($token);

// Get the spreadsheet instance
$spreadsheet = $client->getSpreadsheet($guid, 0); // 0 for the first worksheet

// Get the spreadsheet instance and request configuration
$result = $spreadsheet->setData([[1,2,3]]);

print_r($result);