data.yafb.net
v0.1.1
Published
Transform Your Google Sheets into Powerful APIs Instantly
Readme
data.alterloop.dev
Google Spreadsheet API with Google Apps Script
This project allows you to use a Google Spreadsheet as a database and interact with it via a REST API. The API supports operations such as listing, inserting, updating, and deleting records.
Deployment Steps
1. Create Your Google Spreadsheet
- Go to Google Sheets.
- Create a new spreadsheet.
- Name the sheet (e.g.,
Database). - In the first row, define the column names (e.g.,
id,name,email).
2. Open Google Apps Script
- Click on Extensions → Apps Script.
- Delete any existing code.
- Copy and paste the provided Apps Script code.
3. Configure Script Permissions
- Click Deploy → New Deployment.
- Select Web app as the deployment type.
- Set Who has access to "Anyone".
- Click Deploy and authorize the script.
4. Get Your API URL
After deployment, you will get a URL like:
https://script.google.com/macros/s/your-script-id/execUse this URL to interact with your API.
5. API Endpoints
GET /list→ Retrieve all recordsPOST /insert→ Add a new recordPOST /update→ Update an existing recordPOST /delete→ Remove a record
6. Example Request
curl -X GET "https://script.google.com/macros/s/your-script-id/exec?action=list"Now your Google Spreadsheet is a fully functional database API! 🚀
Proxy
This echo server is used to test the proxy server. It is hosted on Google Apps Script.
function doGet(request) {
const response = ContentService.createTextOutput(JSON.stringify(request, null, 2));
response.setMimeType(ContentService.MimeType.JSON);
return response
}
function doPost(request) {
const response = ContentService.createTextOutput(JSON.stringify(request, null, 2));
response.setMimeType(ContentService.MimeType.JSON);
return response
}