问题
In range A1 I have a drop-down validation list. Based on the user's selection from that list I would like to dynamically create a new drop-down validation list in range C1. For instance, in A1 the list contains:
A
B
C
So if the user selects A from the list, the new list in C1 contains:
1) Annoying Orange
2) Angry Birds
3) Arbitrary Sample
If the user selects B, the new list contains:
1) Bloated Code
2) Better Left Unsaid
3) Bad Attempt
etc
Easy enough to do using VBA. But in GAS.... I have absolutely no idea of how to even start :/
回答1:
The Apps Script API for data validation was just released: http://googleappsdeveloper.blogspot.com/2013/08/answering-another-top-request-data.html
回答2:
You could follow the example in the accepted answer to Google spreadsheet Script Create Data Validation in certain range.
... up until last week, it would have worked. Unfortunately, the Data Validation class and related Range methods getDataValidation() and setDataValidation() have disappeared.
Your only avenue at this point is to visit Issue 2958 and star it, so you receive updates if & when the API is refreshed.
来源:https://stackoverflow.com/questions/17515902/drop-down-validation-list-created-dynamically