Skip to content

Rows

The following methods are available for rows operations.

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

MethodDescription
getRowGet a row data.
@param rowNumber - row number

`Jspreadsheet getRow(rowNumber: number
insertRowInsert a new row.
@param numOfRows - number of rows that must be inserted. Default is 1.
@param rowNumber - reference row for insertion. Default is the last row.
@param insertBefore - insert before or after reference line. Default is false.
@param data - row instructions object. New row values.

`Jspreadsheet insertRow(options?: { numOfRows?: number; rowNumber?: number; insertBefore?: boolean; data?: ({ data: { [key: string]: string }
moveRowChange the row position.
@param from - row number.
@param to - to the position.

Jspreadsheet moveRow(from: number, to: number): Promise<void>

POST /api/:guid/rows/move
deleteRowDelete rows.
@param rowNumber - row number.
@param numOfRows - number of rows. Default is 1.

Jspreadsheet deleteRow(rowNumber: number, numOfRows?: number): Promise<void>

POST /api/:guid/rows/delete
setHeightUpdate the row height.
@param row - row number.
@param height - new height.

`Jspreadsheet setHeight(row: number
getHeightGet the height of one or multiple rows.
@param rowNumber - row number. If omitted, returns the heights of all rows.

`Jspreadsheet getHeight(rowNumber?: number

Add a new row at the end of the spreadsheet

Section titled “Add a new row at the end of the 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 = '15eb1171-5a64-45bf-be96-f52b6125a045';
// Get the spreadsheet instance
const spreadsheet = client.getSpreadsheet(guid);
const data = [['Apple', '$3.442', 'USA']];
// Insert data
spreadsheet.insertRow({ data }).then((result) => {
console.log(result);
});
// {
// numOfRows: 1,
// rowNumber: 5,
// insertBefore: 0,
// data: [{
// id: 5075,
// row: 6,
// data: [
// "Apple",
// "$3.442",
// "USA",
// ],
// }],
// }
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);
const data = [['1', '2', '3'], ['4', '5', '6']];
// Insert data
spreadsheet.insertRow({
rowNumber: 5,
insertBefore: false,
data
}).then((result) => {
console.log(result);
});
// {
// numOfRows: 2,
// rowNumber: 5,
// insertBefore: 0,
// data: [
// { id: 5077, row: 6, data: ["1", "2", "3"]},
// { id: 5078, row: 7, data: ["4", "5", "6"]}
// ]
// }

Change the row position, from the first to the second position.

Section titled “Change the row position, from the first to the second position.”
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.moveRow(0, 1).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);
// Delete the first row
spreadsheet.deleteRow(0).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);
// Delete three rows from the forth column
spreadsheet.deleteRow(3, 3).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);
// Set the height
spreadsheet.setHeight(0, 30).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);
// Set the height
spreadsheet.setHeight([0, 1, 2], 50).then(() => {
// It worked correctly
})
.catch((err) => {
// Something weng 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);
// Result
spreadsheet.getHeight(0).then((heights) => {
console.log(heights);
});
// {
// "0": {
// height: 30
// }
// }
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);
// Result
spreadsheet.getHeight([2, 3, 4]).then((heights) => {
console.log(heights);
});
// {
// "1": { height: 50 },
// "2": { height: 142 },
// "3": { height: 175 },
// }
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);
// Result
spreadsheet.getRow([0, 1]).then((rows) => {
console.log(rows);
});
// [
// {
// row: 0, data: ["b", "a", "", "1", "sdfg"]
// },
// {
// row: 1, data: ["", "", "", "1", ""]
// },
// ]
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);
// Result
spreadsheet.getRow(0).then((rows) => {
console.log(rows);
});
// [
// {
// row: 0, data: ["b", "a", "", "1", "sdfg"]
// },
// ]