How to add user input from form to google sheets after submit

Hello again,

It seems you haven’t made much headway with this (original thread).

We’re still missing pieces of the puzzle, but based on what you posted, this would do the job.

<!DOCTYPE html>
<html>
<head>
  <link href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" rel="stylesheet">
  <title>Demo</title>
</head>
<body>
  <div class="container">
    <form class="needs-validation" novalidate="">
      <div class="form-row">
        <div class="col-md-6 mb-3">
          <label for="validationCustom01">First name</label>
          <input class="form-control" id="first_name" name="first_name" placeholder="First Name" required="" type="text">
          <div class="valid-feedback">
            Looks good!
          </div>
          <div class="invalid-feedback">
            This is required!
          </div>
        </div>
      </div>

      <button class="btn btn-primary btn-block" type="submit">Submit</button>
    </form>
  </div>
  
  <script>
    const form = document.querySelector('form');

    form.addEventListener('submit', function(event) {
     event.preventDefault();

     if (form.checkValidity() === false) {
       alert("failed");
       form.classList.add('was-validated');
     } else {
       google.script.run.processForm(form);
       alert("sucess");
       form.reset();
     }
    }, false);
  </script>
</body>
</html>

This would of course rely on the google module being available and in scope.