{"id":28262,"library":"spreadsheet-db","title":"spreadsheet-db","description":"A lightweight Python library that uses Google Sheets as a database. Currently at version 1.3, with no regular release cadence.","status":"active","version":"1.3","language":"python","source_language":"en","source_url":"https://github.com/da-huin/spreadsheet_db","tags":["google-sheets","database","spreadsheet","orm"],"install":[{"cmd":"pip install spreadsheet-db","lang":"bash","label":"PyPI"}],"dependencies":[{"reason":"Required for authentication with Google APIs.","package":"google-auth","optional":true},{"reason":"Underlying library to interact with Google Sheets.","package":"gspread","optional":false}],"imports":[{"note":"Main class to use.","wrong":"","symbol":"SpreadsheetDB","correct":"from spreadsheet_db import SpreadsheetDB"}],"quickstart":{"code":"from google.oauth2.service_account import Credentials\nfrom spreadsheet_db import SpreadsheetDB\nimport os\n\ncreds = Credentials.from_service_account_file(\n    os.environ.get('GOOGLE_APPLICATION_CREDENTIALS', 'credentials.json')\n)\ndb = SpreadsheetDB('MySheet', credentials=creds)\ndb.insert({'name': 'Alice', 'age': 30})\nresult = db.select({'name': 'Alice'})\nprint(result)","lang":"python","description":"Initialize with credentials and use insert/select like a database."},"warnings":[{"fix":"Ensure your sheet has headers in the first row matching the dictionary keys you intend to insert.","message":"The library expects a Google Sheets document with the first row as headers. Inserting a row without a header column will raise an error.","severity":"gotcha","affected_versions":"all"},{"fix":"Use the returned rows with column index from headers. For dictionary format, iterate over headers manually.","message":"The select() method returns all matching rows as lists, not dictionaries, and ordering is not guaranteed.","severity":"gotcha","affected_versions":"all"},{"fix":"Use google.oauth2.service_account.Credentials instead of gspread's ServiceAccountCredentials.","message":"The library uses gspread's ServiceAccountCredentials, which is deprecated in favor of google-auth directly.","severity":"deprecated","affected_versions":"all"}],"env_vars":null,"last_verified":"2026-05-09T00:00:00.000Z","next_check":"2026-08-07T00:00:00.000Z","problems":[{"fix":"Enable the Google Sheets API via the Google Cloud Console under APIs & Services.","cause":"The Google Sheets API is not enabled for the Google Cloud project.","error":"gspread.exceptions.APIError: {'code': 403, 'message': 'Google Sheets API has not been used in project ...'}"},{"fix":"Run 'pip install --upgrade spreadsheet-db' to get the latest version.","cause":"The version of spreadsheet-db may be outdated or installed incorrectly.","error":"AttributeError: 'SpreadsheetDB' object has no attribute 'insert'"},{"fix":"Ensure the credentials file path is correct and the service account has access to the sheet.","cause":"The service account key file is missing, expired, or not properly configured.","error":"oauth2client.client.HttpAccessTokenRefreshError: invalid_grant"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}