Spreadsheet meta
Meta information are a useful tool to keep information from a cell hidden from the user. Manage the cell meta information of your online spreadsheets using the following methods.
Documentation
Section titled “Documentation”Methods
Section titled “Methods”Available methods for cell comments management.
| Method | Description |
|---|---|
| getMeta | Get the meta information of a cell. @param cellNames - cell names and/or ranges. Jspreadsheet getMeta(cellNames?: string): Promise<{ [cellName: string]: object }> GET /api/:guid/meta |
| setMeta | Add meta information to the spreadsheet cells. @param metas[].cellName - reference cell. @param metas[].value - cell meta information. If null, remove current meta information from cell. `Jspreadsheet setMeta(metas: { cellName: string; value: object |
| resetMeta | Remove all the meta information. Jspreadsheet resetMeta(): Promise<void> DELETE /api/:guid/meta |
Examples
Section titled “Examples”Read the meta information
Section titled “Read the meta information”Get all meta information from a spreadsheet
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 = '79b45919-c751-4e2b-a49a-6c1286e2fc03';
// Get the spreadsheet instanceconst spreadsheet = client.getSpreadsheet(guid);
// Get all meta informationspreadsheet.getMeta().then((metas) => { console.log(metas);});
// {// B2: {// key: "value",// },// D4: {// key2: "value 2",// },// }Get the meta information from a cell
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 = '79b45919-c751-4e2b-a49a-6c1286e2fc03';
// Get the spreadsheet instanceconst spreadsheet = client.getSpreadsheet(guid);
// Get the meta informationspreadsheet.getMeta("A1") // A1,A2,A3 or A1:A3 for multiple cells .then((metas) => { console.log(metas); });Add meta information
Section titled “Add meta information”Meta information are hidden information related to the cells in your spreadsheet.
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 = '79b45919-c751-4e2b-a49a-6c1286e2fc03';
// Get the spreadsheet instanceconst spreadsheet = client.getSpreadsheet(guid);
// New meta informationconst meta = [ { cellName: "B2", value: { key: "value", }, }, { cellName: "D4", value: { key2: "value 2", }, },];
// Update meta informationspreadsheet.setMeta(meta).then(() => { // It worked correctly}).catch((err) => { console.log(err);});Reset the meta information
Section titled “Reset the meta information”The following code will reset the meta information of the whole table.
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 = '79b45919-c751-4e2b-a49a-6c1286e2fc03';
// Get the spreadsheet instanceconst spreadsheet = client.getSpreadsheet(guid);
// Resetspreadsheet.resetMeta().then(() => { // It worked correctly}).catch((err) => { // Something went wrong console.log(err);});