I currently have 2 server-side scripts that handle data from an html form. The first script saves user input to the last row available in my Google sheet, while the second script adds additional details to the newly created row.
Although both scripts work well, it is a bit cumbersome to manually run the second script or set up a time-based trigger. My question is: Is there a way to automate the execution of these two scripts sequentially or merge them into one?
Script 1 (adds new row)
function AddRecord(company, salutation, name, phone, email, appointment, room) {
var url = 'SHEET_URL';
var ss = SpreadsheetApp.openByUrl(url);
var webAppSheet = ss.getSheetByName("SHEE_ID");
webAppSheet.appendRow([company, salutation, name, phone, email, appointment, room]);
}
Script 2 (adds more details to the appended row)
function addMoreDetailsToRecord() {
var url = 'SHEET_URL';
var ss = SpreadsheetApp.openByUrl(url);
var webAppSheet = ss.getSheetByName("SHEE_ID");
var data = webAppSheet.getDataRange().getValues();
var data_len = data.length;
for (var i = 0; i < data_len; i++) {
if (data[i][7] == "8:00 AM" && data[i][9] === "" && data[i][10] === "") {
webAppSheet.getRange(i + 1, 9).setValue("NEW APPOINTMENT");
webAppSheet.getRange(i + 1, 10).setValue("ROOM NUMBER ONE");
webAppSheet.getRange(i + 1, 11).setValue("NAME OF ORGANIZER");
}
else if (data[i][7] == "10.00AM" && data[i][9] === "" && data[i][10] === "") {
webAppSheet.getRange(i + 1, 9).setValue("NEW APPOINTMENT");
webAppSheet.getRange(i + 1, 10).setValue("ROOM NUMBER TWO");
webAppSheet.getRange(i + 1, 11).setValue("NAME OF ORGANIZER");
}
}
}
Thank you in advance for any assistance or guidance provided.