Auto-built from: Quote Title β Company β Project β Location β Date
Customer / Recipient
π Google Sheets Quote Number Sync (Optional β persistent numbering across devices)
Paste your Cloudflare Worker URL (the proxy that talks to Google Sheets). How to set up β
Why a Worker? Google Apps Script blocks direct browser requests (CORS). A Cloudflare Worker sits in between β it fetches Apps Script server-side where CORS doesn't apply, then passes the result back to the browser with the correct headers. Takes ~5 minutes to set up once.
Step 1 β Set up the Google Sheet & Apps Script
1a. Open your Google Sheet β add a tab named Counters with row 1 headers: Key | Count
1b. In the Sheet, click Extensions β Apps Script
1c. Paste this code (replace YOUR_SHEET_ID with your Sheet ID from the URL):
function doGet(e) {
const sheet = SpreadsheetApp.openById('YOUR_SHEET_ID').getSheetByName('Counters');
const entity = (e.parameter.entity || 'ST').replace(/[^A-Z]/g, '');
const d = new Date();
const key = entity + '_' + d.getFullYear() + '_' + (d.getMonth() + 1);
const data = sheet.getDataRange().getValues();
let row = -1;
for (let i = 1; i < data.length; i++) {
if (data[i][0] === key) { row = i + 1; break; }
}
let count;
if (e.parameter.action === 'peek') {
count = row > 0 ? parseInt(data[row - 1][1]) + 1 : 1;
} else {
if (row > 0) {
count = parseInt(sheet.getRange(row, 2).getValue()) + 1;
sheet.getRange(row, 2).setValue(count);
} else {
sheet.appendRow([key, 1]);
count = 1;
}
}
return ContentService.createTextOutput(JSON.stringify({ count: count, key: key }))
.setMimeType(ContentService.MimeType.JSON);
}
1d. Deploy β New Deployment β Web App β Execute as: Me β Who has access: Anyone β Deploy β copy the Web App URL
Step 2 β Create the Cloudflare Worker (CORS proxy)
2a. Go to dash.cloudflare.com β Workers & Pages β Create β Worker
2b. Give it a name like sejati-counter β click Deploy
2c. Click Edit code β replace everything with this (paste your Apps Script URL on line 1):