Skip to main content

Google Sheets as a Backend — a database-like interface for Google Sheets.

Project description

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 or the MCP server (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.
  • 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.9.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) · 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 · terminal UI · 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.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

gsab-0.9.0.tar.gz (10.4 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

gsab-0.9.0-py3-none-any.whl (65.0 kB view details)

Uploaded Python 3

File details

Details for the file gsab-0.9.0.tar.gz.

File metadata

  • Download URL: gsab-0.9.0.tar.gz
  • Upload date:
  • Size: 10.4 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for gsab-0.9.0.tar.gz
Algorithm Hash digest
SHA256 fae73f67bafca7a97c047484cb2fc4d3b7cb4fa7b41c304b896e2e5587f72557
MD5 0aa1936e8a733d6639e543d4f50b5974
BLAKE2b-256 78899253ce987057b7abf623a84ffdc3a17c61aceefd9c20dacb2648642c5a34

See more details on using hashes here.

Provenance

The following attestation bundles were made for gsab-0.9.0.tar.gz:

Publisher: publish.yml on ajmalaksar25/gsab

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file gsab-0.9.0-py3-none-any.whl.

File metadata

  • Download URL: gsab-0.9.0-py3-none-any.whl
  • Upload date:
  • Size: 65.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for gsab-0.9.0-py3-none-any.whl
Algorithm Hash digest
SHA256 8c42080f5c38d6b3c8c9bc200a20a7adda3e763363855cb8e9c831c5bf96657d
MD5 bf70d811c4f4cfc00e91396bf7112d03
BLAKE2b-256 bec994727d7c485cdb008b3713c76ed03924253f034778d64a5907511f75c09a

See more details on using hashes here.

Provenance

The following attestation bundles were made for gsab-0.9.0-py3-none-any.whl:

Publisher: publish.yml on ajmalaksar25/gsab

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page