Turn Your Google Sheet into a Free Public REST API

Turn Your Google Sheet into a Free Public REST API

You can now easily turn your Google Sheet into a public API for free.


We created this guide and video tutorial because we needed a simple way to store data for use with Google Tag Manager (GTM).


Before this, we had two options: either set up a server and pay a developer to save the data, which is costly, or use a service like Zapier, which can get expensive when saving thousands of rows.


This guide uses a simple one-column Google Sheet as an example, but the code can be easily modified to support multiple columns. If you're not a programmer, don't worry; the steps are straightforward and involve copy-pasting code.


What is an API? For those who are new to this, API stands for Application Programming Interface. Very simply, you can use a URL in the browser or an code to read from your google sheet or write to it.

Don't Feel Like Reading? We Made a Video Explaining the Full Details of the Topic. Click Here to Scroll Down to The Video

Steps to Create Your Google Sheet API

1. Create Google Sheet

  1. Create a Column: Create a new Google Sheet and add a header to column A, like "Users."
  2. Add Data: Add data below the header. For instance, write "Bob" in cell A2 and "Jason" in cell A3.
  3. Name the Sheet: By default, it’s probably named "Sheet1." If you change this, remember to update the API request path later on.

2. Create Apps Script


  1. Access Apps Script: In your Google Sheet, go to the top menu and click on "Extensions" -> "Apps Script."
  2. Edit Code.gs: In the script editor, replace the existing code with the content from this repository's Code.gs. Make sure to edit row 70 where it says "Users" to match the header of your column A.
  3. Deploy: After editing, set a project title and click on "Deploy" -> "New Deployment."

3. Set Permissions and Publish

  1. Deployment Type: Make sure to deploy as a "Web app."
  2. Copy Web App URL: After deploying, you'll get a Web App URL like https://script.google.com/macros/s/xxxxxxxxxxxxxx/exec. This is your API endpoint.

4. Test Your API

  1. Reading the Sheet: Add ?path=Sheet1&action=read to the end of your Web App URL.
  2. Writing to the Sheet: Add ?path=Sheet1&action=write&Users=[name] to the end of your Web App URL to add a new row. For example, to add a user named "Jimmy," you would append ?path=Sheet1&action=write&Users=Jimmy.

5. Start Using It

Congratulations! You've just turned your Google Sheet into a simple but powerful public API. Enjoy using it for your projects.

Additional Notes

  • Duplicate Checks: The script will check for duplicates before appending a new row. If a duplicate is found, it will not add the new entry.
  • Access and Limitations: Make sure to read about sharing settings in Google Sheets and familiarize yourself with Google Sheets and Apps Scripts guidelines, quotas, and limitations.
  • Disclaimer: All code and instructions are provided "as is." By using this guide, you agree that you are solely responsible for your actions.

GitHub URL

For the full code and updates, visit our GitHub repository.

Video Explainer on The Full Topic

Thank You For Reading Our Articles!

We're dedicated to providing real answers, valuable insights & efficient knowledge online. Through our content, we strive to share information that matters, leveraging technology to multiply efforts & minimize waste.

Your support is invaluable, so please subscribe, share, & help with your insight and engage with our amazing community!

Leave a comment

Please note, comments need to be approved before they are published.