Spaces:
Runtime error
Runtime error
Download src/gsheet.py from sujitv14/Automated_Web_Development_Lab_Evaluation: direct link, hf CLI and curl.
- Browser
- Download file 516 Bytes
-
https://huggingface.co/spaces/sujitv14/Automated_Web_Development_Lab_Evaluation/resolve/main/src/gsheet.py
- Command line
-
hf download hf://spaces/sujitv14/Automated_Web_Development_Lab_Evaluation/src/gsheet.py
-
curl -L -o gsheet.py https://huggingface.co/spaces/sujitv14/Automated_Web_Development_Lab_Evaluation/resolve/main/src/gsheet.py
516 Bytes
| import os | |
| import json | |
| from google.oauth2.service_account import Credentials | |
| import gspread | |
| def connect_sheet(): | |
| creds_dict = json.loads(os.environ["GOOGLE_CREDENTIALS"]) | |
| credentials = Credentials.from_service_account_info( | |
| creds_dict, | |
| scopes=[ | |
| "https://www.googleapis.com/auth/spreadsheets", | |
| "https://www.googleapis.com/auth/drive" | |
| ] | |
| ) | |
| client = gspread.authorize(credentials) | |
| sheet = client.open_by_key("YOUR_SHEET_ID").sheet1 | |
| return sheet |