> ## Documentation Index
> Fetch the complete documentation index at: https://sdk.grid.is/llms.txt
> Use this file to discover all available pages before exploring further.

# TypeScript / JavaScript SDK

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](https://app.grid.is/openapi.yaml).

## Installation

The library is [available as a package on npm](https://www.npmjs.com/package/@grid-is/api). You can install the package with:

```term theme={null}
npm install @grid-is/api
```

## Before you start

Follow our [getting started guide](/api-reference/getting-started) 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_TOKEN`. Both methods are supported, but using an environment variable is the recommended approach for better security and maintainability.

<CodeGroup>
  ```bash MacOS/Linux theme={null}
  export GRID_API_TOKEN="YOUR_API_KEY"
  ```

  ```powershell Windows theme={null}
  setx GRID_API_TOKEN "YOUR_API_KEY"
  ```
</CodeGroup>

## Example usage

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

```typescript theme={null}
import Grid from "@grid-is/api";

const client = new Grid({
  // Defaults to process.env["GRID_API_TOKEN"]
  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](/api-reference/introduction) and see our [SDK code on Github](https://github.com/GRID-is/api-sdk-ts).
