Complete the code to create a dropdown menu in cell A1 with options "Yes" and "No".
DataValidationBuilder = SpreadsheetApp.newDataValidation().requireValueInList([1]).build() SpreadsheetApp.getActiveSheet().getRange('A1').setDataValidation(DataValidationBuilder)
The method requireValueInList expects a list of strings inside square brackets. So ["Yes", "No"] is correct.
Complete the code to set a dropdown menu in cell B2 with options from the range C1:C5.
var range = SpreadsheetApp.getActiveSheet().getRange('C1:C5'); var rule = SpreadsheetApp.newDataValidation().requireValueInRange([1], true).build(); SpreadsheetApp.getActiveSheet().getRange('B2').setDataValidation(rule);
The method requireValueInRange requires a Range object, so passing the variable range is correct.
Fix the error in the code to create a dropdown menu in cell D4 with options "Red", "Green", "Blue".
var rule = SpreadsheetApp.newDataValidation().requireValueInList([1]).build(); SpreadsheetApp.getActiveSheet().getRange('D4').setDataValidation(rule);
The list of options must be an array of strings with quotes around each option, like ["Red", "Green", "Blue"].
Fill both blanks to create a dropdown menu in cell E5 with options from range F1:F10 and show a help message "Select a color".
var range = SpreadsheetApp.getActiveSheet().getRange('F1:F10'); var rule = SpreadsheetApp.newDataValidation().requireValueInRange([1], true).setHelpText([2]).build(); SpreadsheetApp.getActiveSheet().getRange('E5').setDataValidation(rule);
The first blank needs the Range object range. The second blank needs the help text string "Select a color".
Fill all three blanks to create a dropdown menu in cell G7 with options "Small", "Medium", "Large", show help text "Pick size", and allow invalid input.
var rule = SpreadsheetApp.newDataValidation().requireValueInList([1]).setHelpText([2]).setAllowInvalid([3]).build(); SpreadsheetApp.getActiveSheet().getRange('G7').setDataValidation(rule);
The list of options is ["Small", "Medium", "Large"], the help text is "Pick size", and true allows invalid input.