Connection¶
- class Connection(credentials_path=None, credentials_dict=None)¶
Authenticates with Google and holds the underlying gspread client.
Exactly one of
credentials_pathorcredentials_dictmust be supplied.- Parameters:
- Raises:
ValueError – If neither argument is provided.
Examples¶
From a file:
from betterspread import Connection
con = Connection(credentials_path="./credentials.json")
From an environment variable:
import json
import os
from betterspread import Connection
con = Connection(credentials_dict=json.loads(os.environ["GOOGLE_CREDENTIALS"]))