Cell Values
Get and set values for the spreadsheet cells.
Documentation
Section titled “Documentation”Methods
Section titled “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. Jworksheet getValue(cellNames: string): Promise<{ x: number; y: number; value?: string | number | boolean | null }[]> GET /api/:guid/:worksheetIndex/value/:cellNames |
| setValue | Set worksheet cell values. @param data[].x - cell X coordinate @param data[].y - cell Y coordinate @param data[].value - cell new value Jworksheet setValue(data: { x: number; y: number; value: string; }[]): Promise<string[] | null> POST /api/:guid/:worksheetIndex/value |
Examples
Section titled “Examples”Update the multiple cell values from a spreasdheet in a batch.
Section titled “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 clientconst client = new Client({ // API Server baseUrl: "http://localhost:8009/api", // Your authentication token token: "eyJhbGciOiJIUzUxMiIsInR5cCJ9.eyJkb21haW4iOiJsb2NhbGhvc3Q6ODAPQSJ9.Xr2Ir2-zEc_tqV5y6i",});
// Spreadsheet Guidconst guid = '15eb1171-5a64-45bf-be96-f52b6125a045';
// Get the spreadsheet instanceconst spreadsheet = client.getSpreadsheet(guid);
// Get Jworksheet objectconst worksheet = spreadsheet.getWorksheet(0);
// Options for the new worksheet @See Jspreadsheet documentation for more optionsconst values = [ { x: 0, y: 0, value: "A1" }, { x: 1, y: 0, value: "B1" },];
// Resultworksheet.setValue(values).then((result) => { console.log(result);});curl -X POST "http://localhost:8009/api/15eb1171-5a64-45bf-be96-f52b6125a045/0/value" \ -H "Authorization: Bearer eyJhbGciOiJIUzUxMiIsInR5cCJ9.eyJkb21haW4iOiJsb2NhbGhvc3Q6ODAPQSJ9.Xr2Ir2-zEc_tqV5y6i" \ -H "Content-Type: application/json" \ -d '{ "data": [ { "x": 0, "y": 0, "value": "Á1" }, { "x": 1, "y": 0, "value": "B1" } ] }'