Menu

How to send an HTML form to Google Sheets
📰

How to send an HTML form to Google Sheets

DEV Community: html·Harsimran jeet Singh·about 1 hour ago
#FH1Wr8zB
#devto2#devto#dev#sheet#form
Reading 0:00
15s threshold

A Google Sheet is the place a lot of people want form submissions to end up. Everyone on the team can open it, filter it and add a "called back?" column, and nobody has to log in to another tool.

Sheets can't take a form post by itself, though. Something has to receive the submission and write the row. This guide does it two ways: a free Google Apps Script web app you set up yourself, and a form backend that creates the sheet and fills it for you.

1. Option A: Google Apps Script

Set up the sheet

Create a new spreadsheet and type these headers in row 1, one per column:

timestamp name email message

Each header has to match a field name in your form exactly, including case. That's how the script knows which value goes in which column. The script writes to the first tab.

Add the script

In the sheet, open Extensions → Apps Script , delete what's there and paste this:

function doPost ( e ) { const data = JSON . parse ( e . postData .…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.