set_data_validation 与 pygsheets | Python<>Google 开车
set_data_validation with pygsheets | Python<>Google Drive
我在使用 pygsheets 在我的 Google 电子表格文档中设置数据验证时遇到了困难。我找到了这个函数:
wks.set_data_validation((startIndex, wks.get_named_ranges("stdArbeitsauftrag").start_addr[1]), condition_type='ONE_OF_RANGE', condition_values='=CONFIG!E3:E')
# wks is my current worksheet
# startIndex is the cell to start
# wks.get_named_ranges("stdArbeitsauftrag").start_addr[1]) should be the same column as in startIndex, but does not work (it works with set_dataframe though) - I will take care of this later
# condition_type='ONE_OF_RANGE' should define a range of values
# condition_values='=CONFIG!E3:E' is the range of value in the same document
调用它会引发 400 错误,文本如下:
returned "Invalid requests[0].setDataValidation: ConditionType 'ONE_OF_RANGE' requires exactly one ConditionValue, but 12 values were supplied.". Details: "Invalid requests[0].setDataValidation: ConditionType 'ONE_OF_RANGE' requires exactly one ConditionValue, but 12 values were supplied."
有人可以帮忙吗?
此致,
曼纽尔
从docs开始,condition_values应该是一个列表。试试这个
wks.set_data_validation((startIndex, wks.get_named_ranges("stdArbeitsauftrag").start_addr[1]), condition_type='ONE_OF_RANGE', condition_values=['=CONFIG!E3:E'])
我在使用 pygsheets 在我的 Google 电子表格文档中设置数据验证时遇到了困难。我找到了这个函数:
wks.set_data_validation((startIndex, wks.get_named_ranges("stdArbeitsauftrag").start_addr[1]), condition_type='ONE_OF_RANGE', condition_values='=CONFIG!E3:E')
# wks is my current worksheet
# startIndex is the cell to start
# wks.get_named_ranges("stdArbeitsauftrag").start_addr[1]) should be the same column as in startIndex, but does not work (it works with set_dataframe though) - I will take care of this later
# condition_type='ONE_OF_RANGE' should define a range of values
# condition_values='=CONFIG!E3:E' is the range of value in the same document
调用它会引发 400 错误,文本如下:
returned "Invalid requests[0].setDataValidation: ConditionType 'ONE_OF_RANGE' requires exactly one ConditionValue, but 12 values were supplied.". Details: "Invalid requests[0].setDataValidation: ConditionType 'ONE_OF_RANGE' requires exactly one ConditionValue, but 12 values were supplied."
有人可以帮忙吗?
此致, 曼纽尔
从docs开始,condition_values应该是一个列表。试试这个
wks.set_data_validation((startIndex, wks.get_named_ranges("stdArbeitsauftrag").start_addr[1]), condition_type='ONE_OF_RANGE', condition_values=['=CONFIG!E3:E'])