Spaces:
Build error
Build error
Update google_sheets_utils.py
Browse files- 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 |
-
|
| 25 |
-
|
|
|
|
|
|
|
|
|
|
| 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)
|