> ## 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.

# Python SDK

Use our library to get convenient and idiomatic access to GRID's REST API from Python. It's generated from our [OpenAPI specification](https://app.grid.is/openapi.yaml).

## Installation

The library is [available as a package on PyPI](https://pypi.org/project/grid-api/). You can install the package with:

```term theme={null}
pip install grid_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 Python 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:

```python theme={null}
from grid_api import Grid

client = Grid(
    # Defaults to os.environ.get("GRID_API_TOKEN")
    api_key="YOUR_API_KEY",
)

response = client.workbooks.query(
    id="YOUR_WORKBOOK_ID",
    options={"values": "formatted" },
    read=["A1:C10"],
)
print(response.read)
```

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-py).
