22 lines
568 B
Python
22 lines
568 B
Python
|
import os
|
||
|
import gspread
|
||
|
from oauth2client.service_account import ServiceAccountCredentials
|
||
|
from dotenv import load_dotenv
|
||
|
|
||
|
|
||
|
load_dotenv()
|
||
|
|
||
|
# SET UP GOOGLE SPREADSHEET
|
||
|
SPREADSHEET_ID = os.getenv('SPREADSHEET_ID')
|
||
|
SCOPES = [
|
||
|
'https://www.googleapis.com/auth/spreadsheets',
|
||
|
'https://www.googleapis.com/auth/drive'
|
||
|
]
|
||
|
|
||
|
CREDENTIALS = ServiceAccountCredentials.from_json_keyfile_name('creds_service_acc.json', SCOPES)
|
||
|
client = gspread.authorize(CREDENTIALS)
|
||
|
|
||
|
|
||
|
# Open the spreadsheet using the correct spreadsheet key
|
||
|
spreadsheet = client.open_by_key(SPREADSHEET_ID)
|