I am new to google apis. I am looking to read a google spreadsheet via a python program and following instructions found here:
I have a google sheet called Legislators 2017 that I am using for this.
The following is the code to print out some content from the sheet.
import gspread
from oauth2client.service_account import ServiceAccountCredentials
scope = ['https://www.googleapis.com/auth/drive']
creds = ServiceAccountCredentials.from_json_keyfile_name('google_drive_oct_6_2020.json', scope)
client = gspread.authorize(creds)
sheet = client.open("Legislators 2017").sheet1
list_of_hashes = sheet.get_all_records()
print(list_of_hashes)
The above works.
I am inclined to use the smallest scope possible in general, and would like to use
https://www.googleapis.com/auth/spreadsheets or
https://www.googleapis.com/auth/spreadsheets.readonly
but they don't work and I get an exception with the following message:
Insufficient Permission: Request had insufficient authentication scopes.
What am I missing ?