Filter by Category / Type
| Category | Item | Tags |
|---|
Google Apps Script Backend Setup
Connect a Google Sheet so new entries sync automatically to this tool.
1
Open your Google Sheet (the one you want to use as the backend). Go to Extensions → Apps Script.
2
Create two sheets named
Demand and Supply. Each needs columns: CATEGORY, ITEM, LINK, TAGS (comma-separated).3
Paste the Apps Script code below into the editor. Replace
YOUR_SHEET_ID with your actual Google Sheet ID (from the URL).4
Click Deploy → New Deployment → Web app. Set "Execute as: Me" and "Who has access: Anyone". Copy the deployment URL.
5
In this HTML file, find
APPS_SCRIPT_URL near the top of the script section and replace it with your deployment URL. The tool will then fetch live data on load.Apps Script Code (paste into your project)
const SHEET_ID = 'YOUR_SHEET_ID';
function doGet(e) {
const sheet = SpreadsheetApp.openById(SHEET_ID);
const tab = e.parameter.tab || 'Demand';
const ws = sheet.getSheetByName(tab);
const rows = ws.getDataRange().getValues();
const headers = rows[0];
const data = rows.slice(1).filter(r => r[1]).map(r => ({
category: r[0] || '',
item: r[1] || '',
link: r[2] || '',
tags: r[3] ? r[3].split(',').map(t => t.trim()).filter(Boolean) : []
}));
return ContentService
.createTextOutput(JSON.stringify({ data }))
.setMimeType(ContentService.MimeType.JSON);
}
function doPost(e) {
const payload = JSON.parse(e.postData.contents);
const sheet = SpreadsheetApp.openById(SHEET_ID);
const ws = sheet.getSheetByName(payload.tab || 'Demand');
if (payload.action === 'add') {
ws.appendRow([
payload.category || '',
payload.item || '',
payload.link || '',
(payload.tags || []).join(', ')
]);
return ContentService
.createTextOutput(JSON.stringify({ success: true }))
.setMimeType(ContentService.MimeType.JSON);
}
if (payload.action === 'delete') {
const rows = ws.getDataRange().getValues();
for (let i = rows.length - 1; i >= 1; i--) {
if (rows[i][1] === payload.item && rows[i][2] === payload.link) {
ws.deleteRow(i + 1);
break;
}
}
return ContentService
.createTextOutput(JSON.stringify({ success: true }))
.setMimeType(ContentService.MimeType.JSON);
}
return ContentService
.createTextOutput(JSON.stringify({ error: 'Unknown action' }))
.setMimeType(ContentService.MimeType.JSON);
}