Google Apps Script Code:
function doPost(e) {
try {
const sheet = SpreadsheetApp.openById('1qsgaTWjhXbO9w2CZLEyUip5dkc8jWCtIGealUMkLVBM');
const ws = sheet.getActiveSheet();
const data = JSON.parse(e.postData.contents);
ws.appendRow([
data.timestamp,
data.techName,
data.location,
data.brand,
data.productType,
data.colorName,
data.sku,
data.size,
data.notes,
'No'
]);
return ContentService.createTextOutput('Success');
} catch (error) {
return ContentService.createTextOutput('Error: ' + error.toString());
}
}
function doGet(e) {
return ContentService.createTextOutput('PNL Tracker is working!');
}
Instructions:
- Go to script.google.com
- Create "New Project"
- Replace the code with the code above
- Save the project
- Deploy β New Deployment β Web app β Execute as "Me" β Access "Anyone" β Deploy
- Copy the web app URL and paste it above