title: Post multiple checkbox selections in comma list to Google Sheets
body: <p>I'm using a script to enter data from an HTML form into a Google Sheet. Is there a way I can modify this (or add something else) so that my checkbox fields will be entered into my Google Sheet as a list, separated by commas?</p>
  
  <p>So with the form below, I would want the cell for "time" in Google Sheets to list 9am,10am,11am if all boxes were checked. Right now, it only displays the value of the first box that's checked.</p>
  
  <p><strong>Form example:</strong></p>
  
  <pre><code>&lt;form&gt;
  &lt;input type="checkbox" name="time" value="9am"&gt;
  &lt;label for="time"&gt;9:00am&lt;/label&gt;&lt;br&gt;
  &lt;input type="checkbox" name="time" value="10am"&gt;
  &lt;label for="time"&gt;10:00am&lt;/label&gt;&lt;br&gt;
  &lt;input type="checkbox" name="time" value="11am"&gt;
  &lt;label for="time"&gt;11:00am&lt;/label&gt;&lt;br&gt;
  &lt;button type="submit"&gt;Submit times&lt;/button&gt;
  &lt;/form&gt;
  </code></pre>
  
  <p><strong>The script (from <a href="https://github.com/jamiewilson/form-to-google-sheets" rel="nofollow noreferrer">https://github.com/jamiewilson/form-to-google-sheets</a>):</strong></p>
  
  <pre><code>&lt;script&gt;
    const scriptURL = 'https://script.google.com/macros/s/XXXX/exec'
    const form = document.forms['submit-to-google-sheet']
  
    form.addEventListener('submit', e =&gt; {
      e.preventDefault()
      fetch(scriptURL, { method: 'POST', body: new FormData(form)})
        .then(response =&gt; console.log('Success!', response))
        .catch(error =&gt; console.error('Error!', error.message))
    })
  &lt;/script&gt;
  </code></pre>