0Learn commited on
Commit
952613e
·
verified ·
1 Parent(s): 2c96ba7

Update google_sheets_utils.py

Browse files
Files changed (1) hide show
  1. google_sheets_utils.py +5 -2
google_sheets_utils.py CHANGED
@@ -21,8 +21,11 @@ SCOPES = ['https://www.googleapis.com/auth/spreadsheets',
21
  'https://www.googleapis.com/auth/drive']
22
 
23
  creds_json = os.environ.get('GOOGLE_SHEETS_CREDENTIALS_FILE')
24
- creds_file = json.loads(creds_json)
25
- creds = Credentials.from_service_account_file(creds_file, scopes=SCOPES)
 
 
 
26
  client = gspread.authorize(creds)
27
 
28
  # Open the Google Sheet (create it if it doesn't exist)
 
21
  'https://www.googleapis.com/auth/drive']
22
 
23
  creds_json = os.environ.get('GOOGLE_SHEETS_CREDENTIALS_FILE')
24
+ if not creds_json:
25
+ raise ValueError("GOOGLE_SHEETS_CREDENTIALS_FILE environment variable is not set")
26
+
27
+ creds_dict = json.loads(creds_json)
28
+ creds = Credentials.from_service_account_info(creds_dict, scopes=SCOPES)
29
  client = gspread.authorize(creds)
30
 
31
  # Open the Google Sheet (create it if it doesn't exist)