如何使用Google表格API向Google表格添加下拉列表python
问题描述:
使用Google Sheets API python
如何将dropdown list
添加到Google表格list items
[YES。 NO,MAYBE]邀请朋友是否会参加活动。如何使用Google表格API向Google表格添加下拉列表python
我看着谷歌开发者表api文档HERE并没有提供任何示例。
寻找JSON结构。
其结果将是这样的:
谢谢!
答
我发现setDataValidation
属性内的伎俩,并选择ONE_OF_LIST
为condition type
,所有我需要做的是提供value
列表
{
"setDataValidation": {
"range": {
"sheetId": sheet_id,
"startRowIndex": 1,
"endRowIndex": 1,
"startColumnIndex": 22,
"endColumnIndex": 23
},
"rule": {
"condition": {
"type": 'ONE_OF_LIST',
"values": [
{
"userEnteredValue": 'YES',
},
{
"userEnteredValue": 'NO',
},
{
"userEnteredValue": 'MAYBE',
},
],
},
"showCustomUi": True,
"strict": True
}
}
},
内的项目清单