import gspread
from oauth2client.service_account import ServiceAccountCredentials
scope = ['https://www.googleapis.com/auth/drive']
credentials = ServiceAccountCredentials.from_json_keyfile_name('Credentials.json',scope)
result = gspread.authorize(credentials)
res = result.open('A').sheet1
print(res.get_all_records())
Traceback (most recent call last):
File "C:\Users\Umair\PycharmProjects\Web\venv\lib\site-packages\gspread\client.py", line 123, in open
self.list_spreadsheet_files()
File "C:\Users\Umair\PycharmProjects\Web\venv\lib\site-packages\gspread\utils.py", line 37, in finditem
return next((item for item in seq if func(item)))
StopIteration
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:/Users/Umair/PycharmProjects/Web/PhytonRandom.py", line 6, in <module>
res = result.open('A').sheet1
File "C:\Users\Umair\PycharmProjects\Web\venv\lib\site-packages\gspread\client.py", line 131, in open
raise SpreadsheetNotFound
gspread.exceptions.SpreadsheetNotFound
Tags:
从GSpread documentation开始:
指定的工作表标题(在您的代码中,
A
)必须存在于您的帐户中。此外,名为Sheet1
的工作表也必须存在,以便代码行res = result.open('A').sheet1
也可以访问该工作表相关问题 更多 >
编程相关推荐