HTML Form To Google Sheets is a free, copy-paste guide for building a mailing-list or contact form that posts submissions directly into a Google Sheet using Google Apps Script as a hidden web-app endpoint; it requires no backend server and works with any plain HTML page.
What is HTML Form To Google Sheets?
HTML Form To Google Sheets connects a plain HTML form to a Google Sheet by using Google Apps Script as the only intermediary. You paste the provided script into the Apps Script editor, run a one-time initialSetup function, deploy the script as a web app, and set the generated /exec URL as your form's action. The script reads POST parameters, matches them against the sheet's header row, and appends a new row with the current timestamp in the Date column. It is derived from the GitHub project jamiewilson/form-to-google-sheets and updated for the 2026 Script Editor layout.
Key Features
- No backend required — The HTML form posts directly to a deployed Apps Script web app, so you don't need Node, PHP, or a dedicated server; a static HTML file or any website works.
- Case-sensitive mapping — The script uses the sheet's header values as the parameter names, and the guide stresses that input
nameattributes must match the headers exactly. - Automatic Date column — When a header is literally "Date", the script inserts the current timestamp instead of reading it from the form.
- Safety lock — The
doPostfunction wraps writes inLockServiceand usestry/finallyto avoid concurrent submissions overwriting each other. - Deployment flexibility — The guide shows both the production
/execURL and the/devURL from Test deployments for quick iteration. - JSON response — The script returns
ContentServiceJSON indicating success or error, which you can use in an AJAX handler. - Interception option — A linked CodePen demonstrates attaching a JavaScript event listener to prevent the default redirect and instead post with
fetch.
Who is it for?
- Small business owners who want a custom-branded contact form that lands in their existing Google Sheet without paying for a commercial form service.
- Indie web developers who need a quick form backend for a static site and are already comfortable with Google Drive tooling.
- Email marketers setting up a mailing-list capture that feeds directly into a Sheet they can later export to their newsletter platform.
- Prototype builders who want to test a user-submission flow in minutes using only a browser and a Google account.
What can you do with it?
- Mailing-list signup: Collect
EmailandNamefields into a Sheet, then use the Sheet as a source for a Mailchimp or MailerLite import. - Lead capture: Add a "Request a quote" form to a landing page and watch responses accumulate in a spreadsheet for follow-up.
- Event registration: Take RSVP data from a simple form and use the same script, adjusting the header names to match.
- Feedback forms: Replace a static mailto link with a form that stores structured responses in rows, including a timestamp.
How does it work?
The tutorial walks through five steps: create a Sheet with headers, open Extensions → Apps Script, replace the default function with the provided script, run initialSetup once to save the spreadsheet ID to script properties, then deploy as a web app with "Execute as: Me" and "Who has access: Anyone". Afterward, copy the /exec URL into your form's action and set method="POST"; each submission appends a row. For testing, use the /dev URL from Test deployments. The script uses SpreadsheetApp to find the sheet named Sheet1 and writes at getLastRow() + 1.
FAQ
Why do input names need to match the spreadsheet headers exactly?
The script builds each new row by mapping the sheet's header values and looking up e.parameter[header] from the POST request. If the name attribute in the HTML doesn't match the header casing, the value will be undefined and the cell will be empty. The guide explicitly calls out case sensitivity.
What does the Google warning mean when running initialSetup?
Because your Apps Script has not been reviewed by Google, the authorization screen shows an "Unsafe" warning. Clicking "Go to Mailing List (Unsafe)" is expected: it simply grants the script permission to access the current spreadsheet and write rows.
Can I submit the form without the user being redirected?
Yes. The page includes a link to a CodePen example that attaches a JavaScript event listener to the form's submit event, prevents the default browser navigation, and sends the request yourself. This also lets you show a success message on the same page.
Why does the script editor look different?
The guide is updated for the 2026 version of the Google Script Editor, where the deployment flow is under Deploy → New deployment and you must click "Enable deployment types settings" to choose Web app.
Is there a free service that skips Apps Script?
Yes, the page suggests Sheet Monkey, a free service that lets you submit forms to Google Sheets without writing any Apps Script code.








