How to collect form data from a JAMStack website to Google Sheets using Google Cloud Functions

Abubakar Siddiq Ango
7 min readMar 29, 2020

In the term JAMStack, the ‘A’ in JAM stands for APIs, allowing you to fetch data from different services to render on your static website. In some use-cases, you need to collect data from users and for a static website, you’ll have to depend on an API, most often a custom API endpoint. In this tutorial, we will see how you can create a Google Cloud Functions endpoint to receive data from a form, append it to a Google Sheet and send an email notification using NodeJS runtime.

Before writing any code, let's go through a few setups:

  • Create a Google Cloud project
  • Enable Google Sheets API in Google Cloud Platform
  • Create a Google Sheet to store data

Create a Google Cloud Project

First, we need to create a project in the Google Cloud Console:

  • Click on the Select from dropdown list at the top of the page, a modal will appear with a list of existing project and a New Project link on the top right corner of the modal
New Project button
  • Specify a Project name, billing information and other necessary details.

Enable Google Sheets API

--

--