Spaces:
Sleeping
Sleeping
Update src/gsheets.py
Browse files- src/gsheets.py +4 -2
src/gsheets.py
CHANGED
@@ -9,8 +9,10 @@ def upload_csv_to_new_worksheet(topic_string):
|
|
9 |
scope = ["https://spreadsheets.google.com/feeds", "https://www.googleapis.com/auth/drive"]
|
10 |
|
11 |
# link service account with roles set and api enabled
|
12 |
-
|
13 |
-
|
|
|
|
|
14 |
client = gspread.authorize(creds)
|
15 |
|
16 |
spreadsheet = client.open_by_url('https://docs.google.com/spreadsheets/d/12N10KBYoPwFnvu3iTRgfGhVVlNFeo06BxVDlcFnwSC4/edit#gid=1761713442')
|
|
|
9 |
scope = ["https://spreadsheets.google.com/feeds", "https://www.googleapis.com/auth/drive"]
|
10 |
|
11 |
# link service account with roles set and api enabled
|
12 |
+
gcp_service_account_json = os.environ.get("GCP_SERVICE_ACCOUNT_KEY")
|
13 |
+
gcp_service_account_info = json.loads(gcp_service_account_json)
|
14 |
+
|
15 |
+
creds = ServiceAccountCredentials.from_json_keyfile_dict(gcp_service_account_info, scope)
|
16 |
client = gspread.authorize(creds)
|
17 |
|
18 |
spreadsheet = client.open_by_url('https://docs.google.com/spreadsheets/d/12N10KBYoPwFnvu3iTRgfGhVVlNFeo06BxVDlcFnwSC4/edit#gid=1761713442')
|