Skip to content

Config

The configuration defines styles, data, columns and other properties from a spreadsheet.

The following methods are available to interact with the spreadsheet headers programmatically.

MethodDescription
getConfigGet the worksheet configuration object.

Jworksheet getConfig(): Promise<Partial<Worksheet>>;

GET /api/:guid/:worksheetIndex
setConfigSet the worksheet configuration.
@param config - New definitions.

Jworksheet setConfig(config: Partial<Worksheet>): Promise<void>;

POST /api/:guid/:worksheetIndex/config

Get the configuration of the remote worksheet by the guid identifier.

import { Client } from "@intrasheets/client";
// Create a new client
const client = new Client({
// API Server
baseUrl: "http://localhost:8009/api",
// Your authentication token
token: "eyJhbGciOiJIUzUxMiIsInR5cCJ9.eyJkb21haW4iOiJsb2NhbGhvc3Q6ODAPQSJ9.Xr2Ir2-zEc_tqV5y6i",
});
// Spreadsheet Guid
const guid = '15eb1171-5a64-45bf-be96-f52b6125a045';
// Get the spreadsheet instance
const spreadsheet = client.getSpreadsheet(guid);
// Get Jworksheet object
const worksheet = spreadsheet.getWorksheet(0);
// Get config
worksheet.getConfig().then((config) => {
console.log(config);
});
Terminal window
curl -X GET "http://localhost:8009/api/15eb1171-5a64-45bf-be96-f52b6125a045/0" \
-H "Authorization: Bearer eyJhbGciOiJIUzUxMiIsInR5cCJ9.eyJkb21haW4iOiJsb2NhbGhvc3Q6ODAPQSJ9.Xr2Ir2-zEc_tqV5y6i"

Change the configuration of a spreadsheet.

import { Client } from "@intrasheets/client";
// Create a new client
const client = new Client({
// API Server
baseUrl: "http://localhost:8009/api",
// Your authentication token
token: "eyJhbGciOiJIUzUxMiIsInR5cCJ9.eyJkb21haW4iOiJsb2NhbGhvc3Q6ODAPQSJ9.Xr2Ir2-zEc_tqV5y6i",
});
// Spreadsheet Guid
const guid = '79b45919-c751-4e2b-a49a-6c1286e2fc03';
// Get the spreadsheet instance
const spreadsheet = client.getSpreadsheet(guid);
// Get Jworksheet object
const worksheet = spreadsheet.getWorksheet(0);
// New config
const config = {
filters: true
};
// Set config
worksheet
.setConfig(config)
.then(() => {
// It worked correctly
})
.catch((err) => {
// Something went wrong
console.log(err);
});
Terminal window
curl -X POST "http://localhost:8009/api/79b45919-c751-4e2b-a49a-6c1286e2fc03/0/config" \
-H "Authorization: Bearer eyJhbGciOiJIUzUxMiIsInR5cCJ9.eyJkb21haW4iOiJsb2NhbGhvc3Q6ODAPQSJ9.Xr2Ir2-zEc_tqV5y6i" \
-H "Content-Type: application/json" \
-d '{
"filters": true
}'