sujitv14/Automated_Web_Development_Lab_Evaluation
0
1import os2import json3from google.oauth2.service_account import Credentials4import gspread5 6def connect_sheet():7 8 creds_dict = json.loads(os.environ["GOOGLE_CREDENTIALS"])9 10 credentials = Credentials.from_service_account_info(11 creds_dict,12 scopes=[13 "https://www.googleapis.com/auth/spreadsheets",14 "https://www.googleapis.com/auth/drive"15 ]16 )17 18 client = gspread.authorize(credentials)19 sheet = client.open_by_key("YOUR_SHEET_ID").sheet120 21 return sheet