title: How to extract response items from a Google Form
body: <p>I have made a form to capture 2 data.</p>
  
  <ol>
  <li>Email address.</li>
  <li>Group which user wants to subscribe to.</li>
  </ol>
  
  <p>Each group has their own spreadsheet. [According to the posted code, each has their own <em>sheet</em> within the same <em>spreadsheet</em>.]</p>
  
  <p>When a user submits the form, the form should capture the email address, and sends the data to the respective spreadsheet which the user subscribed to.</p>
  
  <p>This is what I've done so far. I'm stuck..</p>
  
  <p>Is there a way to retrieve data specifically from a particular textbox/options ..etc?</p>
  
  <p>The only way I know is to loop all the data and retrieve it 1 by 1.. and that makes it difficult for me to link 2 data together... eg: <code>"johndoh@email.com" subscribed to "Group 1"</code></p>
  
  <pre><code>function onFormSubmit() {
    var form = FormApp.getActiveForm();
  
    var formResponses = form.getResponses();
    for (var i = 0; i &lt; formResponses.length; i++) {
      var formResponse = formResponses[i];
      var itemResponses = formResponse.getItemResponses();
      for (var j = 0; j &lt; itemResponses.length; j++) {
        var itemResponse = itemResponses[j];
  
        // Checks if it is multiple choice option
        if (itemResponse.getItem().getType() == FormApp.ItemType.MULTIPLE_CHOICE) {
  
          // If user chooses group 1, open spreadsheet and store user's email in 1st column
          if (itemResponse.getResponse() == "1") {
            var ss = SpreadsheetApp.openById("id goes here");
            var sheet = ss.getSheetByName("Group subscription email");
          }
        }
  
  
      }
    }
  }
  </code></pre>