gspread“SpreadsheetNotFound”在某些工作簿上 [英] gspread "SpreadsheetNotFound" on certain workbooks

查看:414
本文介绍了gspread“SpreadsheetNotFound”在某些工作簿上的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个包含数百个工作簿的Google Drive文件夹。我想循环查看列表并更新数据。出于某种原因,gspread只能打开某些工作簿,而不能打开其他工作簿。我只是最近有这个问题。

这不是访问问题,因为所有内容都位于同一个文件夹中。

当我 open_by_key(key) raise SpreadsheetNotFound >。但是,当我把钥匙粘贴到一个URL中时,工作表打开。这意味着它不是关键。



这是怎么回事?我很惊讶其他人没有遇到这个错误。



我是否可以限制Google床单的数量?我有大约2千人。



更新:我发现,如果我进入工作簿并捅了一下,表格就会被识别出来。这是什么意思?如果工作表最近没有活动,它不会识别该工作表。



另外,如果我尝试使用Google App Script SpreadsheetApp.openById ,钥匙被识别!所以表单就在那里,我无法用 gspread 打开它。我已经使用Google脚本首先在表格中写入内容,然后才能被 gspread 识别。

我是能够使用 pygsheets 打开工作表,但由于它是新的,所以越野车,我不能使用它。它看起来像 APIv4 问题?有些工作表无法用 APIv3



更新打开:这里是另一种观察。一旦用APIv4打开工作簿,就不能再使用V3打开工作簿。

解决方案

我的猜测是您可能会触碰 Google Drive API 限制每用户每100秒查询 1000 ,无法更改为更高值。



解决方案1: 您可以尝试申请更高的配额,方法是前往项目页面

1 - 控制台

2 - QUOTAS

3 - 点击在 每用户每100秒查询 之后的铅笔上 -
4 - 然后点击 申请更高配额 em>

5 - 您最终会在 https://support.google.com/code/contact/drive_quota ,但如果您执行上述步骤,表单将包含项目 user 详情已经填好。




解决方案2:



我的帐户中只有几张电子表格存在同样的问题,问题可以通过以下方式解决:



打开json密钥文件( projectname-ca997255dada.json

2 - 找到<$ c的值$ c> client_email ,即:

 client_email:278348728734832-compute@developer.gserviceaccount .com,



<3> - 使用该电子邮件分享您的工作表



注意:您可以尝试只更改一个无法打开的电子表格,并检查上述问题是否能解决问题。

I have a google drive folder with hundreds of workbooks. I want to cycle through the list and update data. For some reason, gspread can only open certain workbooks but not others. I only recently had this problem.

It's not an access issue because everything is in the same folder.

I get raise SpreadsheetNotFound when I open_by_key(key). But then when I take the key and paste it into an URL, the sheet opens. Which means it's not the key.

What's going on here? I'm surprised other people are not encountering this error.

Have I hit my limit on the number of Google sheets I can have? I have about 2 thousand.

Update: I find that if I go into the workbook and poke around, the sheet is then recognized??!! What does this mean? It doesn't recognize the sheet if the sheet isn't recently active???

Also if I try using Google App Script SpreadsheetApp.openById, the key is recognized! So the sheet is there, I just can't open it with gspread. I have use Google script to write something to the sheet first before it is recognized by gspread.

I'm able to open the sheet using pygsheets but since it is new and so buggy, i can't use it. It looks like a APIv4 issue? Some sheets can't be opened with APIv3?

update: here is another observation. Once you open the workbook with APIv4, you can no longer open it with V3.

解决方案

My guess is that you may be hitting the Google Drive API limit of "Queries per 100 seconds per user", which is 1000 and cannot be changed to a higher value.

Solution 1:

You can try to apply for a higher quota by going to you project page:
1 - DASHBOARD
2 - QUOTAS
3 - Click on the pencil after "Queries per 100 seconds per user"
4 - Then click "Apply for higher quota"
5 - You'll end-up on https://support.google.com/code/contact/drive_quota, but if you follow steps above, the form will have the project and user details already filled.


Solution 2:

I had the same issue with just a couple of spreadsheets on my account, the problem was solved by:

1 - Opening the json key file (projectname-ca997255dada.json)
2 - Find the value of client_email , i.e.:

"client_email": "278348728734832-compute@developer.gserviceaccount.com",

3 - Share your sheet(s) with that email

Note: You can try to change just one spreadsheet that you cannot open and check if the above solve the problem.

这篇关于gspread“SpreadsheetNotFound”在某些工作簿上的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆