1
Open Google Sheets → Extensions → Apps Script
2
Paste this script & click Deploy as Web App:
function doPost(e) {
var sheet = SpreadsheetApp.getActiveSpreadsheet().getActiveSheet();
if (sheet.getLastRow() === 0) {
sheet.appendRow(["Date", "Vehicle", "Start Time", "End Time", "Duration (hrs)", "Duration (mins)", "Passenger", "Day/Night", "Notes", "Timestamp"]);
}
var data = JSON.parse(e.postData.contents);
sheet.appendRow([
data.date,
data.vehicle,
data.startTime,
data.endTime,
data.durationHours,
data.durationMinutes,
data.passenger,
data.condition,
data.notes || "",
new Date()
]);
return ContentService.createTextOutput(JSON.stringify({status: "success"}))
.setMimeType(ContentService.MimeType.JSON);
}
3
Paste your Google Web App URL below: