Storing form data from a website in Google Spreadsheets using javascript / React

Setup

Spreadsheet ID highlighted in blue in the URL bar
Click the blue + button to enable the sheets API
Select the Sheets API
API Enabled!
Creating the Sheets API Key
Restricting your API Key to `mywebsite.com`
Restricting your API Key to only the Google Sheets API
Hit the 2 gray squares to copy the Sheets API key to your clipboard, and write it down somewhere
Create an OAuth client ID
Copy the OAUTH client ID (highlighted yellow)

Submitting data from the website contact form to your Google Spreadsheet using Javascript

A simple React Form using the informed library
Creating the variables to hold your Google API data
Specifying an onSubmit event for our Form
Binding informed’s onSubmit function to our class
Making our form submit to sheets
Initializing Google API authorization
Initializing all our Google data in the Sheets API
Data submitted via a web form in a Google Sheet

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store