【发布时间】:2023-03-30 16:23:01
【问题描述】:
我正在尝试使用 gspread 中的 .find 功能来定位一个单元格并更新它旁边的单元格。
我有一些使用 gspread api 的 python 代码。谷歌表格有列名称和颜色。我可以使用 .find 功能来搜索名称为“Joe”的单元格,但是我需要使用另一个名为“color”的变量来更新 Colors 列中“Joe”单元格旁边的单元格。
#Define the variables
name = 'Joe'
color = 'Blue'
# Search the google sheet to find the location of the cell named 'Joe'
sheet.find(name)
# Update the cell next to the location of the cell named 'Joe' with the color variable.
sheet.update(name, color)
我意识到 sheet.update(name,color) 不正确,但不确定如何表达我想要做的事情。我已经检查了 gspread 文档,但是我没有运气。也许还有另一种方法可以实现我不知道的结果。
【问题讨论】: