Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

489
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda