Skip to main content

GSAB — Google Sheets as a Backend

PyPI Python License: MIT Tests

A database-like interface for Google Sheets — schemas, validation, field encryption, async CRUD, server-side queries, and a friction-free CLI. Sign in once; no Google Cloud setup required.

🌐 gsab.ajmalaksar.com  ·  📖 Docs  ·  🗺️ Roadmap

Install

pip install gsab          # core
pip install "gsab[pandas]"  # + DataFrame support

Get started

gsab auth login           # browser sign-in (drive.file scope) — that's the whole setup
gsab init my-app          # scaffold a runnable starter (add --fastapi for a CRUD API)
gsab doctor --live        # prove it works end to end

Then define a schema and read/write your sheet. Full usage, examples and the API → the documentation. gsab import data.csv loads a CSV, and gsab cookbook list shows ready recipes.

Features

  • Friction-free authgsab auth login opens a browser and uses the minimal drive.file scope. No Cloud project, no JSON keys. DIY modes cover existing sheets, your own OAuth client, gcloud, and service accounts.
  • Schemas, keys & validation — typed fields, validation rules, and enforced primary_key / unique columns checked on every write.
  • Field encryption — flag a field encrypted=True and it's sealed before it reaches the sheet.
  • Async CRUD + upsertinsert / read / update / delete plus upsert() for idempotent insert-or-update on a primary key, with rich filters ($gt / $in / $contains / $regex and more).
  • Server-side queriesquery() runs the Google Visualization query language (filter, sort, aggregate) on Google's side, not in Python. Values come back type-correct.
  • Reactive watch() (Experimental) — an async generator that polls + diffs and emits {added, updated, removed}, seeing writes from any connection or the Google UI — drive a live, auto-updating UI. Polling (~1–2s), not push; one poller fans out to many viewers (see examples/realtime-demo/).
  • pandas bridgeto_dataframe() / from_dataframe() and bulk_insert() for the whole analytics ecosystem.
  • Native chartschart() embeds a Google chart in the sheet; or hand to_dataframe() to matplotlib/Plotly.
  • One-call public sharingshare(role=...) publishes a created sheet to a public link (reader/commenter/writer, default reader; csv_url for embedding); unshare() revokes. No extra scope — GSAB owns the sheets it makes.
  • Access control (AccessPolicy) — pass guardrails to SheetManager, the MCP server or the TUI (and share them as a JSON profile): read-only mode, an allowed-sheets allowlist, a share-role cap, destructive-op confirmation, and an activity hook. A client-side guardrail for control + visibility — the OAuth scope stays the real boundary.
  • Access-control TUI (Experimental)gsab tui is a terminal cockpit over AccessPolicy: edit the guardrails, manage the allowlist, probe whether an op would be allowed or blocked (the real check the library and MCP run), and watch a live activity feed. Saves/loads the same profile gsab mcp --policy reads. pip install "gsab[tui]".
  • Actionable errors — Google API errors become clear GSAB exceptions with retry/backoff and token refresh — readable by humans and LLM agents.
  • Installable agent skillsgsab skill install drops GSAB skills into .claude/skills (or --portable for any LLM) so your coding agent knows the real API.
  • MCP servergsab mcp lets any MCP client (Claude, Codex, Cursor, Zed, …) use your Google Sheet as a database directly: create, insert, read, query, upsert, share. --read-only and --policy apply access controls. pip install "gsab[mcp]".
  • Secure tokens — stored in your OS keychain (keyring), with a 0600-file fallback.

Roadmap

Shipped (v0.10.0): auth + CLI · schemas, validation & encryption · async CRUD · upsert + enforced primary keys · type-correct server-side query · reactive watch() (Experimental) · public sharing (reader/commenter/writer) · MCP server (gsab mcp, with --read-only / --policy) · access control (AccessPolicy) · access-control TUI (gsab tui, Experimental) · pandas bridge + bulk insert · native in-sheet charts · LLM-friendly errors + retry/backoff · installable agent skills · scaffolding & CSV import · keychain storage · security CI (bandit + pip-audit).

Coming next: rate-aware batching · improved/pipe-friendly CLI · a JavaScript client · one-click hosted sign-in.

Full roadmap with per-feature stability (and what's deliberately out of scope) → ROADMAP.md. Live summary → gsab.ajmalaksar.com/#roadmap.

Releases

Versioned with SemVer; see CHANGELOG.md. Tagged releases (vX.Y.Z) publish to PyPI automatically via GitHub Actions.

License

MIT — see LICENSE.md. GSAB is an independent project, not affiliated with Google LLC.

Release files for gsab 0.10.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for gsab 0.10.0
File Size Uploaded
gsab-0.10.0.tar.gz 10.4 MB Details

Built distribution (wheel)

Table of built distributions (wheels) for gsab 0.10.0
File Interpreter ABI Platform
gsab-0.10.0-py3-none-any.whl Python 3 none any Details

Total release size: 10.5 MB

Release files / gsab-0.10.0.tar.gz

Download URL gsab-0.10.0.tar.gz
Size 10.4 MB
Tags Source
SHA-256 checksum
How to use checksums
73b4cf85da37c8d375ad8f39c6cd0bba2b007f8d65066fe2bedd14ea0cc3e9bd
BLAKE2b-256 checksum
How to use checksums
0baa223bf3ea409c684e9891431120f7e38abfab957dc9079d64c3ed996595b6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jul 4, 2026.

Transparency log

Release files / gsab-0.10.0-py3-none-any.whl

Download URL gsab-0.10.0-py3-none-any.whl
Size 71.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
c942873b079064cd392282794f9adfc24053997865af25eadc02cb46c79df650
BLAKE2b-256 checksum
How to use checksums
7c6c2f9c435981f8bdd849b03b3dbf4720789b3621ebf5031fe467a92ed8261e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jul 4, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.10.0 This release

2 release files

0.9.0

2 release files

0.8.0

2 release files

0.7.2

2 release files

0.7.1

2 release files

0.7.0

2 release files

0.6.0

2 release files

0.5.0

2 release files

0.4.1

2 release files

0.4.0

2 release files

0.3.2

2 release files

0.3.1

2 release files

0.3.0

2 release files

0.2.0

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page