Cell Values
Get and set values for the spreadsheet cells.
Documentation
Methods
The following methods are available to interact with the spreadsheet cell values programmatically.
Method | Description |
---|---|
getValue | Get the value from one or more worksheet cells. @param cellNames - cell names and/or ranges. `Jspreadsheet getValue(cellNames: string): Promise<{ x: number; y: number; name: string; value: string |
setValue | Set a new data for your spreadsheet @param {x} - cell X coordinate @param {y} - cell Y coordinate @param {value} - string Jspreadsheet setValue(data: { x: number; y: number; value: string }[]): Promise<void> POST /api/:guid/value |
Examples
Update the multiple cell values from a spreasdheet in a batch.
The worksheet position and unique-id is returned.
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);
// Options for the new worksheet @See Jspreadsheet documentation for more options
const values = [
{ x: 0, y: 0, value: 'Á1' },
{ x: 1, y: 0, value: 'B1' }
];
// Result
spreadsheet.setValue(values).then((result) => {
console.log(result);
});