当从google sheets读取/写入时,会出现以下错误:
gspread.exceptions.RequestError: (404, '404: b\'<!DOCTYPE html>
...
Sorry, unable to open the file at present.</p><p> Please check the address and try again.</p>代码已经工作了很多年,但在没有任何更改的情况下突然出现了这个错误。以下是代码。我已经创建了一个新的凭据json文件,但它也无法工作。
SCOPES = ['https://www.googleapis.com/auth/spreadsheets', "https://www.googleapis.com/auth/drive.file","https://www.googleapis.com/auth/drive"]
credentials = ServiceAccountCredentials.from_json_keyfile_name("credentialfile.json", SCOPES)
connection = gspread.authorize(credentials)
worksheet = connection.open(self.sheet).worksheet(tab)有什么建议吗?
发布于 2021-08-30 01:36:54
我也有同样的问题。这是因为谷歌方面的一项改变,要求使用sheets API的v4。( @MattKing给我指出答案的链接)
对我有效的解决方案:pip install -U gspread。我的版本是0.6.2,它升级到了4.0.1,在第一次尝试时一切都正常。
https://stackoverflow.com/questions/68849726
复制相似问题