Skip to content

Spreadsheet Headers

This section covers the methods to handle with the spreadsheet headers.

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

MethodDescription
getHeadersGet the header title by column number. Null for all columns.

`Jspreadsheet getHeaders(column?: number
setHeaderSet a custom header title.
@param title - new title
@param column - column number starting on zero

Jspreadsheet setHeader(column: number, title: string): Promise<void>

POST /api/:guid/header
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);
// Change the header title for the first column
spreadsheet.setHeader(0, "New title").then(() => {
// It worked correctly
}).catch((err) => {
// Something went wrong
console.log(err);
});
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.getHeaders().then((titles) => {
console.log(titles);
});
// {
// "0": "New title",
// "1": "B",
// "2": "C",
// }

Get the title from a specified column number

Section titled “Get the title from a specified column number”
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.getHeaders(1).then((titles) => {
console.log(titles);
});
// { "1": "B" }