Registry / database / spreadsheet-db

spreadsheet-db

JSON →
library1.3pypypiunverified

A lightweight Python library that uses Google Sheets as a database. Currently at version 1.3, with no regular release cadence.

pip install spreadsheet-db
INSTALL
IMPORT
SIG · SPREADSHEET-DB
S
spreadsheet-db
databasepythonv1.3
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

SpreadsheetDB
from spreadsheet_db import SpreadsheetDB
from spreadsheet_db import SpreadsheetDB

Initialize with credentials and use insert/select like a database.

from google.oauth2.service_account import Credentials from spreadsheet_db import SpreadsheetDB import os creds = Credentials.from_service_account_file( os.environ.get('GOOGLE_APPLICATION_CREDENTIALS', 'credentials.json') ) db = SpreadsheetDB('MySheet', credentials=creds) db.insert({'name': 'Alice', 'age': 30}) result = db.select({'name': 'Alice'}) print(result)
Debug
Known issues
gotchaThe library expects a Google Sheets document with the first row as headers. Inserting a row without a header column will raise an error.
fix
Ensure your sheet has headers in the first row matching the dictionary keys you intend to insert.
affects: all
gotchaThe select() method returns all matching rows as lists, not dictionaries, and ordering is not guaranteed.
fix
Use the returned rows with column index from headers. For dictionary format, iterate over headers manually.
affects: all
deprecatedThe library uses gspread's ServiceAccountCredentials, which is deprecated in favor of google-auth directly.
fix
Use google.oauth2.service_account.Credentials instead of gspread's ServiceAccountCredentials.
affects: all
Upgrade
Version history
1.3latest on PyPI · released Aug 6, 2020
Audit
Dependencies
google-authoptionalRequired for authentication with Google APIs.
gspreadrequiredUnderlying library to interact with Google Sheets.
Agent activity
44 hits · last 30 days
node
38
Meta
1
OpenAI (training)
1
Resources
spreadsheet-db — pip install spreadsheet-db · libregistry