Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/google-sheets/3.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 AttributeError:&x27;工作表';对象没有属性';插入_行';_Python_Google Sheets_Gspread - Fatal编程技术网

Python gspread AttributeError:&x27;工作表';对象没有属性';插入_行';

Python gspread AttributeError:&x27;工作表';对象没有属性';插入_行';,python,google-sheets,gspread,Python,Google Sheets,Gspread,我正在尝试使用gspread将行插入到Google电子表格中 self.client = gspread.authorize(creds) ss = self.client.open_by_key(key) sheet = ss.worksheet("total") sheet.insert_rows([["test"], ["test"]], 2) 我得到了一个错误: AttributeError:“工作表”对象没有属性“插入行”

我正在尝试使用gspread将行插入到Google电子表格中

self.client = gspread.authorize(creds)
ss = self.client.open_by_key(key)
sheet = ss.worksheet("total")
sheet.insert_rows([["test"], ["test"]], 2)
我得到了一个错误:
AttributeError:“工作表”对象没有属性“插入行”


有人知道问题是什么吗?奇怪的是,我尝试使用功能
insert\u row
,但在
insert\u rows
时遇到了这个问题,结果发现我使用的是较旧版本的gspread,必须将其更新到v3.6.0才能使用
工作表。insert\u rows()
我认为从错误消息中,您可能正在使用较旧版本的gspread。因为似乎在v3.6.0中添加了
工作表.insert_rows()
。例如,如何将gspread更新到最新版本?但是,如果这不是你问题的直接解决方案,我道歉。@Tanaike谢谢,这对我很有效!谢谢你的回复。我很高兴你的问题解决了。当您的问题得到解决时,您能否将其作为答案发布?这样,它将对其他有相同问题的用户有用。