Versions Compared


  • This line was added.
  • This line was removed.
  • Formatting was changed.


  • Create a Form with a Checkbox/Radio control named Colors.

  • Use this rule to populate the Checkbox/Radio options with the colors Red, Blue, Green and Orange. Note this rule uses http headers to provide authentication information. The Google Sheet is identified by the spreadsheet key and the worksheet name is passed as a query parameter. This is the recommended approach.

    • Replace <Google User ID>  and <Google Account access token> with your information in the user and password

    • headers

    • Change <your spreadsheet key> to the key for your Google Sheet and <the name of the worksheet> to reflect the name of the worksheet tab in your Google Sheet.

    When declaring the options array variable (opts), be careful not to initialize it to contain an element with a value of empty string so you do not see a blank option at the top of the options list. Define the options array as shown below: var opts = [];
    • The rule executes when the form loads and performs an http.get() then evals the results.
    • The results are parsed into an array. The array elements are red=Red, blue=Bue, green=Green and orange=Orange
    • The Color Checkbox/Radio control options are set to the array.


Code Block
/*member colors, password, user, results */
var x;
if (form.load) {
var headers = 
{"user":"<Google user Id>","password":"<Google Account access token>"};    
 var readquery = '/google/spreadsheets/query/key/<your spreadsheet key>?wsname=<the name of the worksheet>';
    eval('x=' + http.get(readquery,headers));                                                                                   

    var opts = [];
    if (x.results) {
        for (var i = 0; i < x.results.length; i++) {
        if (x.results[i].colors) {
                opts[i + 1] = x.results[i].colors;

    Colors.options = opts;    //Colors is the name of the dropdownCheckbox/Radio control