I trying to working with Google Sheet by using Python
Following the guidance from this site: https://www.twilio.com/blog/2017/02/an-easy-way-to-read-and-write-to-a-google-spreadsheet-in-python.html Including steps:
Go to the Google APIs Console.
Create a new project.
Click Enable API. Search for and enable the Google Drive API.
Create credentials for a Web Server to access Application Data.
Name the service account and grant it a Project Role of Editor.
Download the JSON file.
Copy the JSON file to your code directory and rename it to client_secret.json
Here is what I did so far
import gspread
from oauth2client.service_account import ServiceAccountCredentials
scope = ['https://docs.google.com/spreadsheets/d/1IypqDnLKKR-IX1oOwCuTejBQ-RFq87K9rqSF6GpSyn4/edit?usp=drive_web&ouid=109125393303568297837']
creds = ServiceAccountCredentials.from_json_keyfile_name('client_secret.json', scope)
client = gspread.authorize(creds)
sheet = client.open('test_xlsx').sheet1
However, I got this result errors
google.auth.exceptions.RefreshError: ('No access token in response.', {'id_token'..}
Thats not a google scope. this is the list of valid google scopes#sheets
Even the tutorial you are following says to use the following scope. Without including the correct oauth scope you font have access.
scope = ['https://spreadsheets.google.com/feeds']