Posted by João Martins on 13 Apr 2026
How to Submit a Form to Google Sheets Using JavaScript
Use the Fetch API to submit forms to Google Sheets without page reload
Want to submit your form to Google Sheets without a full page reload? Using vanilla JavaScript and the Fetch API, you can send form data to Form2Sheet in the background and show a success message right on the page.
Step 1: Prerequisites
The first step in integrating Form2Sheet is to subscribe either monthly or yearly.
Then, go to https://form2sheet.com and create your first
spreadsheet.
(Email received after creating a spreadsheet)
Step 2: Building Your JavaScript Form Submission
Create an HTML form with a JavaScript event listener that submits data to Form2Sheet using the Fetch API, without reloading the page. Make sure to replace the $API_URL with the one you received
in your email (check your spam folder as well).
<form id="contact-form">
<label>Name:</label>
<input type="text" name="name" />
<label>E-mail:</label>
<input type="email" name="email" />
<label>Message:</label>
<textarea name="message"></textarea>
<button type="submit">Submit</button>
</form>
<div id="success-message" style="display:none;">
Thank you! Your response has been recorded.
</div>
<script>
document.getElementById('contact-form').addEventListener('submit', async (e) => {
e.preventDefault();
const formData = new FormData(e.target);
await fetch('', { method: 'POST', body: formData });
e.target.style.display = 'none';
document.getElementById('success-message').style.display = 'block';
});
</script>
Step 3: Submitting the Form
In the GIF below, you can see how after submitting the form you check the results in
your Spreadsheet.
Besides that, you and the respondent will receive a confirmation email with the data
submitted.
And that's is! Simple as that. Aditionally, you can create Unlimited Spreadsheets, customize the Thank You page, add as many Custom Form Fields as you want and remove the Form2Sheet branding from the emails.
Conclusion
Congratulations! You can now go ahead and publish your custom form. It is now
ready to start collecting responses. With
Form2Sheet, the process is streamlined, and you can focus on obtaining valuable data
without
the hassle of complicated setups.
If this made you curious, go ahead and check our pricing below.