title: Adding items to a Google Forms list from a spreadsheet range
body: <p>I am struggling to get past the last line in this code any help will be appreciated:</p>
  
  <p>The error I am getting is "Array is empty: values (line 16, file "Code")". I have double checked the item ID, the spreadsheet ID and that there is data for it to pick up within the correct range. Any pointers or insights...?</p>
  
  <pre class="lang-js prettyprint-override"><code>  function GetFleet() {
    var ssDEFECTS = SpreadsheetApp.getActiveSpreadsheet().getSheets()[0];
    var rngFLEET = ssDEFECTS.getDataRange();
    var values = rngFLEET.getValues();
    var FleetList = [];
  
  //Use column 0 and ignore row 1 (headers)
    for (var i = 1; i &lt;= values.length; i++) {
      var v = values[i] &amp;&amp; values[i][0];
      v &amp;&amp; values.push(v)
    }
  
    // Form ID &amp; List ID
    var DefectsForm = FormApp.openById('&lt;FORM KEY ID&gt;');
    DefectsForm.getItemById(794194842).asListItem().setChoiceValues(FleetList);
  };
  </code></pre>