Skip to content

Spreadsheet

The following methods helps with the management of basic spreadsheet features.

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

MethodDescription
getSpreadsheetGet a Jspreadsheet object. This is an internal method of the client api and does not reflect any changes to the spreadsheet.

Client getSpreadsheet(guid: string, worksheetIndex?: number): IJspreadsheet

@param guid - spreadsheet guid.
@param worksheetIndex - worksheet position.
createCreate a new spreadsheet and return its Jspreadsheet object.

@param options.description - new spreadsheet name.
@param options.config - new spreadsheet settings.

`Client create(options?: { description?: string, config?: Partial
listSpreadsheetsList spreadsheets owned by or shared with the user.

@param options.offset - number of spreadsheets skipped when performing the search. Default: 0.
@param options.limit - maximum number of spreadsheets returned by the search. If not informed, all results found will be returned..
@param options.invitations - Also search for spreadsheets where the user is invited. Default: false.

Client listSpreadsheets(options?: { offset?: number; limit?: number; invitations?: boolean; }): Promise<{ sheet_guid: string; sheet_description: string; sheet_updated: string; sheet_status: number; sheet_privacy: number; }[]>

GET /api/list
getNewSignatureGenerate a new access signature.

@param token - Specific token for that route.

Client getNewSignature(token: string): Promise<string>

GET /api/signature
getSheetIdWithInvitationGet the spreadsheet id with a guest token.

@param token - Specific token for that route.

Client getSheetIdWithInvitation(token: string): Promise<string>

GET /api/invitation
deleteDelete a existing spreadsheet.

Jspreadsheet delete() : Promise<void>

DELETE /api/:guid
setNameSet the title of the spreadsheet.
Jspreadsheet setName(name?: string): Promise<void>

@param name - new title of the spreadsheet.

POST /api/:guid/name
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",
});
// Options for the new spreadsheet @See Jspreadsheet documentation for more options
const options = {
description: 'My spreadsheet',
config: {
minDimensions: [10, 10],
}
};
// Create a new spreadsheet
client.create(options).then(async (newSpreadsheet) => {
// Result 'My spreadsheet'
console.log(await newSpreadsheet.getName());
});
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",
});
client.listSpreadsheets().then((result) => {
// User spreadsheets
console.log(result);
});
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);
spreadsheet.delete().then(() => {
console.log('Spreadsheet removed');
});
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);
spreadsheet.setName("New name").then(() => {
console.log("Name changed");
});