Using Google Drive and Google Sheets APIs in Cloud functions

Submit a form to a Google function that saves files to a Google Drive folder and then saves file properties to a Google Sheet

Marian C.
7 min readAug 11, 2024

If a web application uses some of the numerous Google Cloud services, it can be a good idea to build the backend of Cloud Function-based microservices.

Cloud functions can be easily integrated with each other and any Google Cloud services. But it is not so well documented how Cloud functions can interact with Google Workspace tools such as Google Drive, Sheets or Docs.

In this post I explore how to make a Cloud function that saves files and values into a Google Drive folder and a Google Sheet. I build from the HTTP triggered Cloud function handling posted files a function saving received multipart form data with the Google Drive API and Google Sheets API.

Upon a request, the sample function saves the uploaded files into a subfolder of a designated Google Drive folder. The user’s id is used as a name for the subfolder:

--

--

Marian C.

Java, JavaScript and SQL developer. Interested in data collection and visualization.