This application serves as an HTML form to the user to let them submit values to the server. This could be to reserve a ticket for a show, book a seat in a venue, book a room in a hotel, and many more purposes.
Create a spreadsheet and create column labels as shown in the following screenshot:
In the code file, create the doGet
, doPost
and cancelReservation
functions:
function doGet(e) { // Maximum available const MAX_TICKETS = 25; // 'cancel' is a query string appended with the published URL. var cancel = e.parameter.cancel; if(cancel){ var msg = cancelReservation(cancel); return ContentService.createTextOutput(msg); } // Replace with your spreadsheet's ID. var ss = SpreadsheetApp.openById("spreadsheet's id"); var SheetReservations = ss.getSheetByName("Reservations"); var data = SheetReservations.getDataRange().getValues(); data.shift(); var template = HtmlService.createTemplateFromFile("Form.html"); template...