I've currently a form that a user fills in and the data is then entered into a spreadsheet. All this works well.

I now need to make one of the inputs an array so that more than one value can be entered.

I've created an add new item (and delete) so the form is now dynamic. But what I can't get working is:

  • how to capture the multiple choices as an array.
  • pass that to my GS code so I know how many items are in the array.
  • Populate the spreadsheet with each array value.

example: I have,

<label class="control-label col-sm-2" for="eav">EAV - Sales $K</label>
<div class="col-sm-2">
    <input type="eav " class="form-control" required="" id="eav" name="eav" placeholder="EAV - Sales $K">

Which now repeats when I click "add new item".

Within my GS I use (which you can see uses other entries too):

  var projectvalues = ([[formObject.probability,  // Probability
             formObject.OEM_OPP,  // OEM or Operator
             "New", // Category - Force to NEW
             formObject.region,  // Region
             formObject.division,  // Division
             formObject.customer,  // Customer
             formObject.operator, // Operator 
             formObject.eav, // EAV -Sales $K
             formObject.project_name]]);  // Project Name

datasheet.getRange(datasheet.getLastRow()+1, 4, 1, 9).setValues(projectvalues);

For each EAV entry (in the eav array) I want to add a new line in the sheet and each new line should have the next eav in the array.

How do I convert the above into handling an array for eav?

Any help would be great.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.