Skip to content

Columns and cell properties

This section covers the methods to manage the properties from a cell or a spreadsheet column.

MethodDescription
getPropertyGet the properties of one cell.
@param column - cell column.
@param row - cell row.

Jworksheet getProperty(column: number, row: number): Promise<{ [property: string]: any; }>

GET /api/:guid/:worksheetIndex/properties/:column/:row
getPropertyGet the properties of one or more columns.
@param columns - column(s) position(s). If omitted, the properties of all columns are returned.

Jworksheet getProperty(columns?: number | number[]): Promise<{ [columnIndex: string]: Column; }>

GET /api/:guid/:worksheetIndex/properties/:columns
setPropertySet the properties of one or more columns. All old properties are removed.
@param properties.[].column - column number
@param properties.[].options - properties values. If omitted, current settings will be removed.

Jworksheet setProperty(properties: { column: number; options?: Column; }[]): Promise<void>
POST /api/:guid/:worksheetIndex/properties
setPropertySet the properties of a cell. All old properties are removed.
@param properties[].column - x coordinate.
@param properties[].row - y coordinate.
@param properties[].options - properties values. If omitted, current settings will be removed.

Jworksheet setProperty(properties: { column: number; row: number; options?: { [property: string]: any; }; }[]): Promise<void>

POST /api/:guid/:worksheetIndex/properties
updatePropertyUpdate the properties of one or more columns. Only the specified properties are affected.
@param properties.[].column - column number
@param properties.[].options - properties values

Jworksheet updateProperty(properties: { column: number; options: Column; }[]): Promise<void>

POST /api/:guid/:worksheetIndex/properties/update
updatePropertyUpdate the properties of a cell. Only the specified properties are affected.
@param properties[].column - x coordinate.
@param properties[].row - y coordinate.
@param properties[].options - properties values.

Jworksheet updateProperty(properties: { column: number; row: number; options: { [property: string]: any; }; }[]): Promise<void>

POST /api/:guid/:worksheetIndex/properties/update
resetPropertiesRemoves all properties of a cell.
@param column - cell column.
@param row - cell row.

Jworksheet resetProperties(column: number, row: number): Promise<void>
POST /api/:guid/:worksheetIndex/properties
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);
// New properties
const properties = {
type: "checkbox",
title: "Column A",
width: 100,
};
// Change the properties from the forth column
worksheet
.setProperty([
{
column: 3,
options: properties,
},
])
.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/properties" \
-H "Authorization: Bearer eyJhbGciOiJIUzUxMiIsInR5cCJ9.eyJkb21haW4iOiJsb2NhbGhvc3Q6ODAPQSJ9.Xr2Ir2-zEc_tqV5y6i" \
-H "Content-Type: application/json" \
-d '{
"properties": [
{
"column": 3,
"options": {
"type": "checkbox",
"title": "Column A",
"width": 100
}
}
]
}'
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);
// Get the properties from the first column
worksheet.getProperty(0).then((properties) => {
console.log(properties);
});
Terminal window
curl -X GET "http://localhost:8009/api/15eb1171-5a64-45bf-be96-f52b6125a045/0/properties/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);
// Get the properties from multiple columns
worksheet.getProperty([0, 1]).then((properties) => {
console.log(properties);
});
Terminal window
curl -X GET "http://localhost:8009/api/15eb1171-5a64-45bf-be96-f52b6125a045/0/properties/0,1" \
-H "Authorization: Bearer eyJhbGciOiJIUzUxMiIsInR5cCJ9.eyJkb21haW4iOiJsb2NhbGhvc3Q6ODAPQSJ9.Xr2Ir2-zEc_tqV5y6i"