How to Turn Your Google Sheet into a Free API in 3 Minutes
So, you need a simple backend. A place to store data for your MVP, your mobile app prototype, or your personal project. You're already using Google Sheets to organize everything, and you think, "If only I could just... get this data out as clean JSON."
Well, you can. And it's surprisingly easy. Today, we're going to show you exactly how to turn your humble spreadsheet into a live, functioning API using the power of Google Apps Script. No servers, no credit cards, just you and a few lines of code.
Step 1: Prepare Your Google Sheet
This is the easy part. Create a new sheet. The most important rule is that the first row must be your header row. These headers will become the JSON keys in your API response. Keep them simple and without spaces (e.g., productName
, stockCount
).
For this guide, let's create a sheet named products
with some sample data:
SKU | ProductName | Description | Price | OriginalPrice | Category | StockStatus | Tags |
---|---|---|---|---|---|---|---|
QL-T004 | 1st Rule of Programming Tee | The golden rule, now on an incredibly soft 100% cotton tee. | ₹449.00 | ₹749.00 | T-Shirts | In Stock | code, funny, rule, works |
QL-T005 | Declare Variables, Not War Tee | This powerful message is printed on our premium black tee. | ₹449.00 | ₹649.00 | T-Shirts | In Stock | peace, variables, war, coding |
QL-T006 | GitHub "The Place I Fork" Tee | Made from a durable, comfortable cotton-poly blend. | ₹449.00 | ₹549.00 | T-Shirts | Low Stock | git, fork, code, programming |
QL-T007 | It Works On My Machine Tee | The perfect gift for anyone who has ever closed a ticket with this phrase. | ₹449.00 | ₹749.00 | T-Shirts | In Stock | funny, shrug, devops, bug |
QL-H001 | The Quantum Hoodie | A heavyweight hoodie for late-night coding sessions. Subtle embroidered | ₹899.00 | ₹1299.00 | Hoodies | In Stock | bestseller, winter, cozy, jacket |
QL-H002 | "Did I Ask For Your Input?" Hoodie | For the developer who prefers to be left alone while in the zone. | ₹799.00 | ₹999.00 | Hoodies | In Stock | funny, input, sarcastic, focus |
QL-T008 | 127.0.0.1 "Home" Tee | There's no place like it. This tee is a simple, clever nod to the place every developer knows and loves. | ₹449.00 | ₹599.00 | T-Shirts | Low Stock | home, localhost, network, geek |
Step 2: Open the Apps Script Editor
This is where the magic lives. In your Google Sheet, go to Extensions > Apps Script
. This will open a new tab with a code editor. It might look a little intimidating, but don't worry, we've done the hard work for you.
Step 3: The Magic Script (Get It Here!)
Delete any placeholder code in the editor. Now, you need the script that will read your sheet and serve it as JSON. We've written a clean, reusable script just for this. To get instant access to the code, just pop your email below. We'll also add you to the early-access list for SheetBridge, where we're automating all of this and adding security, analytics, and more.
Unlock the Rest of this Guide
This content is exclusively for our subscribers. Enter your email to read on and get the free code. We'll add you to the SheetBridge waitlist!
You're in good company. We never spam.
Step 4: Deploy as a Web App
Now that you've pasted the code, you need to "publish" it to the web.
- Click the blue "Deploy" button in the top right.
- Select "New deployment".
- Click the gear icon next to "Select type" and choose "Web app".
- In the dialog:
- For "Execute as", leave it as "Me".
- For "Who has access", you MUST change it to "Anyone". This makes your API public.
- Click "Deploy". You'll be asked to authorize the script. This is you giving your script permission to read your sheet. It's safe.
Step 5: Test Your New API!
After deploying, you'll be given a Web app URL. Copy it, then Click on "Run" in the menubar once. You might be asked for permission once again. allow it and if everything runs fine, you are ready!. That's it. That's your API endpoint!
Believe it or not, you're done. You just built a serverless API. Pretty cool, right? But... now that you have it, you might start asking some important questions like "How do I secure this?" or "How can I let users POST data?"
That's the exact moment you need to stop tinkering and start building.
"This is great, but..."
You've built a fantastic prototype. But as you move toward a real product, you'll notice a few things:
- 😨 It's completely public. Anyone with the URL can see all your data. There are no API keys, no protection.
- 🤔 How do I handle `POST` or `UPDATE` requests? This script only handles `GET`. Writing, updating, and deleting data requires much more complex code.
- 🐢 It's not instant. Apps Script can have a slight "cold start" delay.
- nightmare. If you want to change anything, you have to go back into the script, make edits, and redeploy. There's no dashboard.
Ready for the upgrade? That's SheetBridge.
The free script is awesome for getting started. But when you're ready to build a real application, you need security, reliability, and management. That's why we built SheetBridge.
- Secure API Keys & Full CRUD
- An Intuitive Management Dashboard
- Analytics
- Custom Endpoints
- No Coding or Deploying Required