简体   繁体   English

在处理上述异常的过程中,又发生了一个异常:& google sheet not found

[英]During handling of the above exception, another exception occurred: & google sheets not found

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

From the GSpread documentation :GSpread 文档

open(title)
Raises: gspread.SpreadsheetNotFound – if no spreadsheet with specified title is found.引发: gspread.SpreadsheetNotFound – 如果没有找到具有指定标题的电子表格。

The Sheet title specified (in your code, A ) has to exist in your account.指定的工作表标题(在您的代码中, A )必须存在于您的帐户中。 Furthermore, the sheet with the name Sheet1 must also be present so it can also be accessed by your line of code res = result.open('A').sheet1此外,名称为Sheet1的工作表也必须存在,以便您的代码行也可以访问它res = result.open('A').sheet1

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 在处理上述异常的过程中,又发生了一个异常 - During handling of the above exception, another exception occurred 在处理上述异常期间,发生了另一个异常:Python程序 - During handling of the above exception, another exception occurred: Python program KeyError: 1 在处理上述异常的过程中,又发生了一个异常: - KeyError: 1 During handling of the above exception, another exception occurred: “在处理上述异常过程中,发生了另一个异常”for循环中的第一个输入 - “ during the handling of above exception, another exception occurred ” for the first input in the for loop 如何解决“在处理上述异常期间,发生了另一个异常:” - How to fix "During handling of the above exception, another exception occurred: " Flask-restful - 在处理上述异常的过程中,发生了另一个异常 - Flask-restful - During handling of the above exception, another exception occurred 关键错误:1 在处理上述异常的过程中,发生了另一个异常 - Key Error: 1 During handling of the above exception, another exception occurred KeyError:在处理上述异常的过程中,发生了另一个异常 - KeyError: During handling of the above exception, another exception occurred 在处理上述异常的过程中,发生了另一个异常:'Date' - During handling of the above exception, another exception occurred: 'Date' 在处理上述异常期间,发生了另一个异常 - During handling of the above exception, another exception occured
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM