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 spreadsheet configuration object.

Jspreadsheet getConfig(): Promise<Spreadsheet>

GET /api/:guid
getAllConfigGet all the information from the spreadsheet and some control information.

Jspreadsheet getAllConfig(): Promise<{ sheet_guid: string; sheet_id: string; sheet_description: string; sheet_privacy: number; user_id: number; config: Spreadsheet; sheet_created: string; sheet_updated: string; }>

GET /api/:guid/all
setConfigSet the spreadsheet configuration.
@param config - New definitions.

Jspreadsheet setConfig(config: Partial<Worksheet> & { definedNames?: any; toolbar?: any; tabs?: any; }): Promise<void>

POST /api/:guid/config

Get the configuration of the remote spreadsheet 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);
// Request configuration
spreadsheet.getConfig().then((config) => {
console.log(config);
});

You can get the configuration of the online spreadsheets using the following route:

// Get the configuration properties of the spreadsheet
https://jspreadsheet.com/api/15eb1171-5a64-45bf-be96-f52b6125a045

Get all the configuration of the remote spreadsheet 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);
// Request configuration
spreadsheet.getAllConfig().then((config) => {
console.log(config);
});

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);
// Hide the toolbar
let config = {
definedNames: {
"Test": 3,
}
}
spreadsheet.setConfig(config).then(() => {
// It worked correctly
}).catch((err) => {
// Something went wrong
console.log(err);
});