Skip to content

Rows

The following methods are available for rows operations.

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

MethodDescription
insertRowAdd one or more rows to the worksheet.
@param rows - Position, data and options of new rows.

Jworksheet insertRow(rows: { row: number; data: (string | number | boolean | undefined)[] | Record<string, string | number | boolean>; options: Record<string, any>; }[]): Promise<void>

POST /api/:guid/:worksheetIndex/rows/insert
moveRowMove one or more rows.
@param from - Index of the first row to be moved.
@param to - Index where rows should be moved to.
@param quantity - Number of rows to be moved.

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

POST /api/:guid/:worksheetIndex/rows/move
deleteRowRemove one or more rows.
@param rows - Indexes of the rows to be removed.

Jworksheet deleteRow(rows: number[]): Promise<void>

DELETE /api/:guid/:worksheetIndex/rows/:rowIndexes
setHeightUpdate the row height.
@param row - row number.
@param height - new height.

Jworksheet setHeight(row: number, height: number): Promise<void>
Jworksheet setHeight(row: number[], height: number | number[]): Promise<void>

POST /api/:guid/:worksheetIndex/height
getHeightGet the height of one or multiple rows.
@param rowNumber - row number. If omitted, returns the heights of all rows.

Jworksheet getHeight(rowNumber?: number | number[]): Promise<{ [rowNumber: string]: number; }>

GET /api/:guid/:worksheetIndex/height/:rows
setRowVisibilityChange the visibility of one or more rows.
@param rows - affected rows.
@param visible - row visibility.

Jworksheet setRowVisibility(rows: number | number[], visible: boolean): Promise<void>

POST /api/:guid/:worksheetIndex/rows/show
POST /api/:guid/:worksheetIndex/rows/hide
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);
// Insert data
worksheet.insertRow([
{
row: 1,
data: ['Apple', '$3.442', 'USA'],
}
]).then(() => {
// It worked correctly
});
Terminal window
curl -X POST "http://localhost:8009/api/15eb1171-5a64-45bf-be96-f52b6125a045/0/rows/insert" \
-H "Authorization: Bearer eyJhbGciOiJIUzUxMiIsInR5cCJ9.eyJkb21haW4iOiJsb2NhbGhvc3Q6ODAPQSJ9.Xr2Ir2-zEc_tqV5y6i" \
-H "Content-Type: application/json" \
-d '{
"rows": [
{
"row": 1,
"data": ["Apple", "$3.442", "USA"]
}
]
}'

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);
// Get Jworksheet object
const worksheet = spreadsheet.getWorksheet(0);
worksheet.moveRow(0, 1, 1).then(() => {
// It worked correctly
});
Terminal window
curl -X POST "http://localhost:8009/api/15eb1171-5a64-45bf-be96-f52b6125a045/0/rows/move" \
-H "Authorization: Bearer eyJhbGciOiJIUzUxMiIsInR5cCJ9.eyJkb21haW4iOiJsb2NhbGhvc3Q6ODAPQSJ9.Xr2Ir2-zEc_tqV5y6i" \
-H "Content-Type: application/json" \
-d '{
"from": 0,
"to": 1,
"count": 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);
// Get Jworksheet object
const worksheet = spreadsheet.getWorksheet(0);
// Delete three rows from the forth column
worksheet.deleteRow([1, 3]).then(() => {
// It worked correctly
});
Terminal window
curl -X DELETE "http://localhost:8009/api/15eb1171-5a64-45bf-be96-f52b6125a045/0/rows/1,3" \
-H "Authorization: Bearer eyJhbGciOiJIUzUxMiIsInR5cCJ9.eyJkb21haW4iOiJsb2NhbGhvc3Q6ODAPQSJ9.Xr2Ir2-zEc_tqV5y6i"
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);
// Set the height
worksheet
.setHeight(0, 30)
.then(() => {
// It worked correctly
})
.catch((err) => {
// Something went wrong
console.log(err);
});
Terminal window
curl -X POST "http://localhost:8009/api/15eb1171-5a64-45bf-be96-f52b6125a045/0/height" \
-H "Authorization: Bearer eyJhbGciOiJIUzUxMiIsInR5cCJ9.eyJkb21haW4iOiJsb2NhbGhvc3Q6ODAPQSJ9.Xr2Ir2-zEc_tqV5y6i" \
-H "Content-Type: application/json" \
-d '{
"row": 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);
// Get Jworksheet object
const worksheet = spreadsheet.getWorksheet(0);
// Set the height
worksheet
.setHeight([0, 1, 2], 50)
.then(() => {
// It worked correctly
})
.catch((err) => {
// Something weng wrong
console.log(err);
});
Terminal window
curl -X POST "http://localhost:8009/api/15eb1171-5a64-45bf-be96-f52b6125a045/0/height" \
-H "Authorization: Bearer eyJhbGciOiJIUzUxMiIsInR5cCJ9.eyJkb21haW4iOiJsb2NhbGhvc3Q6ODAPQSJ9.Xr2Ir2-zEc_tqV5y6i" \
-H "Content-Type: application/json" \
-d '{
"rows": [0, 1, 2],
"height": 50
}'
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);
// Result
worksheet.getHeight(0).then((heights) => {
console.log(heights);
});
Terminal window
curl -X GET "http://localhost:8009/api/15eb1171-5a64-45bf-be96-f52b6125a045/0/height/0" \
-H "Authorization: Bearer eyJhbGciOiJIUzUxMiIsInR5cCJ9.eyJkb21haW4iOiJsb2NhbGhvc3Q6ODAPQSJ9.Xr2Ir2-zEc_tqV5y6i"
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);
// Result
worksheet.getHeight([2, 3, 4]).then((heights) => {
console.log(heights);
});
Terminal window
curl -X GET "http://localhost:8009/api/15eb1171-5a64-45bf-be96-f52b6125a045/0/height/2,3,4" \
-H "Authorization: Bearer eyJhbGciOiJIUzUxMiIsInR5cCJ9.eyJkb21haW4iOiJsb2NhbGhvc3Q6ODAPQSJ9.Xr2Ir2-zEc_tqV5y6i"