Install & Compatibility
Where this runs
tested against v0.6.1 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
muslpy 3.10–3.95 runs
installs and imports cleanly · install 0.0s · import 1.374s · 146.6MB
glibcpy 3.10–3.95 runs
installs and imports cleanly · install 5.3s · import 1.292s · 147MB
146MB installed
● package 146MB
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
SheetsManager
✓ from gsheets import Sheets
✗ from gsheets import SheetsManager
Old class name; SheetsManager was renamed to Sheets in v0.3
Sheets
✓ from gsheets import Sheets
Initialize with OAuth client secret file, then access spreadsheet by key.
from gsheets import Sheets
sheets = Sheets.from_files('client_secret.json', 'storage.json')
# Or via environment variable for CI:
import os
sheets = Sheets.from_files(os.environ.get('GSHEETS_CLIENT_SECRET', 'client_secret.json'), os.environ.get('GSHEETS_STORAGE', 'storage.json'))
sheet = sheets['<SPREADSHEET_KEY>']
print(sheet.title)
Errors
Common errors & fixes
ImportError: cannot import name 'SheetsManager' from 'gsheets'
SheetsManager was renamed to Sheets in v0.3.
fixChange import to 'from gsheets import Sheets'
AttributeError: 'Sheets' object has no attribute 'from_files'
Using an older version (<0.3) that didn't have the class-based API.
fixUpgrade to latest: pip install --upgrade gsheets
google.auth.exceptions.RefreshError: invalid_grant
OAuth token expired or client_secret.json is incorrect.
fixDelete storage.json and re-authenticate, or regenerate client_secret.json from Google Cloud Console.
Upgrade
Version history
0.6.1latest on PyPI · released Jun 12, 2022
Audit
Dependencies
google-api-python-clientrequiredRequired for Google Sheets API authentication and client
oauth2clientrequiredUsed for OAuth2 authentication (deprecated in favor of google-auth)