Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

485
Views
Submit Form Data to Google Spreadsheet in another tab (sheet)

I have a website here having two Forms. One under RESERVE VIP TABLE and another in the footer where it says JOIN OUR NEWSLETTER. I've used the following code to submit data from the FORM to Google Sheets. Question is that the first form is working fine but how can I submit the data from Newsletter section to Google Sheets in a separate Tab named "Subscribe"?

Newsletter HTML:

<form method="POST" name="google-sheet">
    <input type="text" name="subscribeEmail" placeholder="Your Email Address">
        <div class="gold-button small">
                    <button type="submit">Submit →</button>
                    <span class="bttn-border left virticle"></span>
                    <span class="bttn-border right virticle"></span>
                    <span class="bttn-border top horizontal"></span>
                    <span class="bttn-border bottom horizontal"></span>
       </div>
</form>

Script I'm using for Reservation Form:

<script>
        const scriptURL = 'https://script.google.com/macros/s/AKfycbzJA2cZGROFNCwLuPnJjECW21zXMZs8nT4Xo0Nzjy5ETlOVQ3gHgyjE3wzzmHky_0I_/exec'
        const form = document.forms['google-sheet']
      
        form.addEventListener('submit', e => {
          e.preventDefault()
          fetch(scriptURL, { method: 'POST', body: new FormData(form)})
            .catch(error => console.error('Error!', error.message))
        })
</script>
over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

If it were me, I'd have to tackle it like this:

HTML:

<form action="https://script.google.com/macros/s/[SCRIPT ID]/exec" method="post">
  <input type="text" name="subscribeEmail" placeholder="Your Email Address">
  <div class="gold-button small">
    <button type="submit">Submit →</button>
    <span class="bttn-border left virticle"></span>
    <span class="bttn-border right virticle"></span>
    <span class="bttn-border top horizontal"></span>
    <span class="bttn-border bottom horizontal"></span>
  </div>
</form>

Apps Script:

function doPost(e) {
  var ss = SpreadsheetApp.openById("SHEET ID");
  var sheet = ss.getSheetByName("Subscribe");
  // or use getRange().setValue() if something specific
  sheet.appendRow([e.parameter.subscribeEmail])
}

Reference:

  • Run Google App Script from web page
over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!