Use our library to get convenient and idiomatic access to GRID’s REST API from TypeScript or JavaScript. It’s generated from our OpenAPI specification.

Installation

The library is available as a package on npm. You can install the package with:

npm install @grid-is/api

Before you start

Follow our getting started guide to get an API key and a workbook id.

You can use your API key in two ways: pass it directly to the client or, preferably, store it in an environment variable named GRID_API_KEY. Both methods are supported, but using an environment variable is the recommended approach for better security and maintainability.

export GRID_API_KEY="YOUR_API_KEY"

Example usage

With the SDK installed, you can query your workbook and get the formatted values in cells A1 to C10:

import Grid from "@grid-is/api";

const client = new Grid({
  // Defaults to process.env["GRID_API_KEY"]
  apiKey: "YOUR_API_KEY",
});

async function main() {
  const response = await client.workbooks.query(
    "YOUR_WORKBOOK_ID",
    {
      options: { values: "formatted" },
      read: ["A1:C10"],
    }
  );

  console.log(response.read);
}

main();

This is just scratching the surface of what’s possible with GRID’s spreadsheet API and SDK. For more information, see our API documentation and see our SDK code on Github.