title: setValue() of an array only pasting one of the values in the array
body: <p>I have a sheet where I am taking the last number at the end of the values in the barcode column, which represents the total number of items in an order.  I put those values in an array.  Then I tried setting the values of the array to the column "Number of Units".  However, it is putting the first value of the array to all the cells in the column.  How can I get it to put each value in the array into its own cell under the "Number of Units" column?</p>
  
  <p>Here is a look at the issue in the Sheet:
  <a href="https://i.stack.imgur.com/egQlZ.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/egQlZ.jpg" alt="enter image description here"></a></p>
  
  <p>Here is what the code is supposed to do:  (I just put the values in manually)<a href="https://i.stack.imgur.com/eQ8su.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/eQ8su.jpg" alt="enter image description here"></a></p>
  
  <p>The numbers after the last hyphen in the barcode column is the number of units.</p>
  
  <p>Here is my code that splits the barcode values and adds the number to an array:</p>
  
  <pre><code>function numberOfUnits() {
    var ss = SpreadsheetApp.getActiveSpreadsheet();
  
    //Get specific sheet
    var sheet = ss.getSheetByName('Sheet3');
  
    // get teh data on the sheet
    var values = sheet.getDataRange().getValues();
    var units = []
    for (var i = 1 ; i &lt; values.length; i++) {
     var barcode = values[i][1];
     var unit = barcode.split('-');
      units.push(unit[unit.length-1]);
  
    }
    return units;
  }
  </code></pre>
  
  <p>This seems to work just fine, but when I call this function from within another function, that is when I get the error.</p>
  
  <p>Here is the other function:</p>
  
  <pre><code>function rate() {
    var ss = SpreadsheetApp.getActiveSpreadsheet();
  
    //Get specific sheet
    var sheet = ss.getSheetByName('Sheet3');
  
    // get the data on the sheet
    var values = sheet.getDataRange().getValues();
    // sets the units as an array of all the units values
    var units = numberOfUnits();
    // sets the unit value to every cell under the "number of units" column
    sheet.getRange(2, values[0].length, values.length, 1).setValue(units);
  
  }
  </code></pre>