如何使用一个API呼叫更新Pyton(GSPREAD)?

发布于 2025-01-22 05:27:07 字数 677 浏览 1 评论 0原文

我有2个Google表文件。第一个有信息,我必须根据某些标准,这与问题无关。我做了。数据包含名称以及不支持的时间。我已经创建了具有这些值的对象,并将它们放在列表中。列表的长度为137。让我们称此列表为“小时_not_supported”。

第二个表文件具有来自A1:A B1:B C1:C的预定义变量,其中包含名称,SIR名称,电子邮件。在Excel文件的最右边,有一个名为“小时”的标头。这些行的长度为170。

现在,由于小时_not_supported列表比第二个文件文件中的行量(137至170)较小,这意味着第二张纸文件具有没有数据的人,因为他们没有填充数据存在于第一个Excel文件中。

我要做的是,如果列表中的对象的名称“小时_not_supported”匹配a1:一个名称,那么基本上是沿if a1:a == object.name的行,我必须放入对象。在表文件之一的最左边,一行,换句话说,更新表。我可以通过循环和一些语句来做到这一点,问题是带有呼叫限制的429错误,我会出错。

那么我想问的是我应该如何进行? update()和batch_update()函数是我看到的唯一使用1个API调用的功能。问题在于,这些功能无法识别让我们说A1的名称是否等于对象列表中的任何名称。另外,我不允许使用功能睡眠。

有什么想法吗?很想写关于编码的尝试,但是对于这个问题,没有什么可写的,因为我提到我无法使用429个错误的循环,并且这些功能不会过滤出哪个名称是哪个。

I have 2 google sheet files. The first one has information that I have to pull out depending on certain criteria's which are irrelevant for the question. That I have done. The data contains names as well as hours not supported. I have created objects with those values and put them in a list. The length of the list is 137. Lets call this list "hours_not_supported".

The second sheet file has predefined variables from A1:A B1:B C1:C which contain names, sir names, emails. On the far right of the excel file there is a header called hours not supported. The length of those rows is 170.

Now since hours_not_supported list is smaller then the amount of rows(137 to 170) in the second sheet file, that means that the second sheet file has people that have no data to be filled since they do not exist in the first excel file.

What I have to do, is if the name of the object in the list "hours_not_supported" matches A1:A name, so basically something along the lines of if A1:A == object.name I have to put in the object.hours in the far left of the sheet file on one of the rows, in other words update the sheet. I can do that with a loop and some if statements, the problem is the 429 error with the call limit, I would error out.

So what I wanted to ask is how should I proceed? the update() and batch_update() functions are the only ones that I saw that only use 1 API call. The problem is that those functions can't identify if lets say A1s name is equal to any of the names within the list of objects. Also, I am not allowed to use the function sleep.

Any ideas? Would love to write what have I tried as far as coding goes, but for this issue specifically there isn't anything to write since I mentioned I can't use loops cause of 429 error and those functions don't filter out which name is which.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文