> ## Documentation Index
> Fetch the complete documentation index at: https://docs.mirage.strukto.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Google Sheets

> Mount Google Sheets spreadsheets as Mirage files from Node or the browser.

`GSheetsResource` exposes Google Sheets as `.gsheet.json` and CSV-style files. Reads return cell values; writes update ranges via the Sheets API.

Setup steps for OAuth credentials live at [Google Workspace Credentials](/home/setup/google).

## Node

```bash theme={null}
pnpm add @struktoai/mirage-node
```

```ts theme={null}
import { GSheetsResource, MountMode, Workspace } from '@struktoai/mirage-node'

const sheets = new GSheetsResource({
  clientId: process.env.GOOGLE_CLIENT_ID!,
  clientSecret: process.env.GOOGLE_CLIENT_SECRET!,
  refreshToken: process.env.GOOGLE_REFRESH_TOKEN!,
})

const ws = new Workspace({ '/sheets': sheets }, { mode: MountMode.READ })
await ws.execute('ls /sheets/owned/')
```

## Browser

```bash theme={null}
pnpm add @struktoai/mirage-browser
```

```ts theme={null}
import { GSheetsResource, MountMode, Workspace } from '@struktoai/mirage-browser'

const sheets = new GSheetsResource({
  clientId: GOOGLE_CLIENT_ID,
  clientSecret: GOOGLE_CLIENT_SECRET,
  refreshToken: localStorage.getItem('gsheets.refresh_token')!,
})
```

## Config

| Field          | Default  | Notes                                                    |
| -------------- | -------- | -------------------------------------------------------- |
| `clientId`     | required | Google OAuth client ID.                                  |
| `clientSecret` | required | Google OAuth client secret. Redacted in snapshots.       |
| `refreshToken` | required | User's refresh token. Redacted in snapshots.             |
| `refreshFn`    | built-in | Optional override for the access-token refresh callback. |

## Mount mode

`read`, partial write (range updates).

For the layout, sheet/tab structure, and write semantics see the [Python Sheets docs](/python/resource/gsheets).
