ayang903 commited on
Commit
1f31541
·
1 Parent(s): 4390068

Update src/gsheets.py

Browse files
Files changed (1) hide show
  1. 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
- gcp_service_account_key = os.environ.get("GCP_SERVICE_ACCOUNT_KEY")
13
- creds = ServiceAccountCredentials.from_json_keyfile_name(gcp_service_account_key, scope)
 
 
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')