I am using the gspread library in python to send api requests.
The request is to set the dropdown.
However, I could not figure out how to set the following.
- set a color for each value in the dropdown
- set the display style to "Chip"
Here is the code.
options = ["Apple", "Banana", "Orange"]
values = [{"userEnteredValue": option} for option in options]
request = {
"requests": [
{
"setDataValidation": {
"range": {
"sheetId": 0,
"startRowIndex": 1,
"endRowIndex": 4,
"startColumnIndex": 1,
"endColumnIndex": 2,
},
"rule": {
"condition": {"type": "ONE_OF_LIST", "values": values},
"strict": False,
"showCustomUi": True
},
}
}
]
}
spreadSheet.batch_update(request)
Please let me know if there is a way to do this. Thanks!