Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/353.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python GSpread get_all_records()读取超过千行时不会自动停止_Python_Google Sheets_Google Spreadsheet Api_Gspread_Google Python Api - Fatal编程技术网

Python GSpread get_all_records()读取超过千行时不会自动停止

Python GSpread get_all_records()读取超过千行时不会自动停止,python,google-sheets,google-spreadsheet-api,gspread,google-python-api,Python,Google Sheets,Google Spreadsheet Api,Gspread,Google Python Api,我需要一个API来帮助我从GoogleSheets中检索数据,所以我尝试使用GSpread从一个工作表中检索3000多行数据,我花了几分钟等待数据打印出来。然而,有些情况下,即使我等待了10分钟以上,数据仍然没有显示出来。奇怪的是10分钟后,当我试图通过点击Ctrl+C来中断程序时,过程结束,没有任何错误,并打印出完整的数据。我还尝试在运行程序1分钟后中断程序,但它显示了一些错误消息,并且没有显示任何数据 这是GSpread中的一个bug,还是在Google表单中检索数千行的一件普通事情?数据检

我需要一个API来帮助我从GoogleSheets中检索数据,所以我尝试使用GSpread从一个工作表中检索3000多行数据,我花了几分钟等待数据打印出来。然而,有些情况下,即使我等待了10分钟以上,数据仍然没有显示出来。奇怪的是10分钟后,当我试图通过点击Ctrl+C来中断程序时,过程结束,没有任何错误,并打印出完整的数据。我还尝试在运行程序1分钟后中断程序,但它显示了一些错误消息,并且没有显示任何数据

这是GSpread中的一个bug,还是在Google表单中检索数千行的一件普通事情?数据检索完成后,程序如何自动结束

这是我的代码(我只是遵循文档):

既然我正在检索上千行代码,那么有没有比GSpread-API更好、更高效的替代方案呢?GSpread-API在从googlesheets到Python检索数据时也更快?因为我不想等待检索数据超过10分钟


提前谢谢

我找到了解决这个问题的方法。它很快,但并不理想。您可以调整工作表的大小,清除所有数据。运行以下代码后,不要忘记删除单元格A1上的内容

worksheet.resize(1,1)
worksheet.resize(1000,26) #or the size of your worksheet

我找到了解决这个问题的方法。它很快,但并不理想。您可以调整工作表的大小,清除所有数据。运行以下代码后,不要忘记删除单元格A1上的内容

worksheet.resize(1,1)
worksheet.resize(1000,26) #or the size of your worksheet