I'm new to googleapiclient. Now, I came up with the code to get the data from GSheet to S3 with credentials.json and token.pickle.
scope = ['https://www.googleapis.com/auth/spreadsheets.readonly']
credentials = get_google_token(scope=scope, token_file=token_file, cred_file=cred_file)
service = build('sheets', 'v4', credentials=credentials, cache_discovery=False)
range_name = sheet_title + '!' + sheet_range_name
# Call the Sheets API
sheet = service.spreadsheets()
result = sheet.values().get(spreadsheetId=spreadsheetId,
range=range_name
).execute()
When I try to do the update the record (Vice versa) I'm not able to authorize the Http and I don't know how to deal with "writing Google Sheet with Google API Client".
scope = ['https://www.googleapis.com/auth/spreadsheets', "https://www.googleapis.com/auth/drive.file", "https://www.googleapis.com/auth/drive"]
credentials = get_google_token(scope=scope, token_file=token_file, cred_file=cred_file)
print(credentials)
service = build('sheets', 'v4', credentials=credentials)
print(service)
values = {'values':[['Hello World',],]}
range_name = sheet_title + '!' + sheet_range_name
# Call the Sheets API to Update the Value
result = service.spreadsheets().values().update(spreadsheetId=spreadsheetId,range=sheet_range_name,valueInputOption='RAW',body=values).execute()