Hello i was looking for this problem 1 - 2 hours and couldnt find anything which is similar to mine. When i start the py i get a traceback error. I did the same things as in the tutorials. 1. I got the GDrive API and authorize it (Account) 2. i shared my Spreadsheet from google to the e-mail given by the Api 3. installed gspread and oauth2client
import gspread
from oauth2client.service_account import ServiceAccountCredentials
scope = ["https//spreadsheets.google.com/feeds"]
cred = ServiceAccountCredentials.from_json_keyfile_name("gsecrets.json", scope)
gc = gspread.authorize(cred)
table = gc.open('KeywordKGR').sheet1
def getCellValue(row, col):
return table.cell(row, col).value
print(getCellValue(1,1))
The Error that i receive is:
Traceback (most recent call last):
File "c:./Allintitle/niche.py", line 8, in <module>
gc = gspread.authorize(cred)
File "C:.\AppData\Local\Programs\Python\Python36-32\lib\site-packages\gspread\__init__.py", line 41, in authorize
client.login()
File "C:.\AppData\Local\Programs\Python\Python36-32\lib\site-packages\gspread\v4\client.py", line 51, in login
self.auth.refresh(http)
File "C:.\AppData\Local\Programs\Python\Python36-32\lib\site-packages\oauth2client\client.py", line 545, in refresh
self._refresh(http)
File "C:.\AppData\Local\Programs\Python\Python36-32\lib\site-packages\oauth2client\client.py", line 749, in _refresh
self._do_refresh_request(http)
File "C:.\AppData\Local\Programs\Python\Python36-32\lib\site-packages\oauth2client\client.py", line 819, in _do_refresh_request
raise HttpAccessTokenRefreshError(error_msg, status=resp.status)
oauth2client.client.HttpAccessTokenRefreshError: invalid_scope: https//spreadsheets.google.com/feeds is not a valid audience string.