First, shoutout to NEWAZA for writing this amazing code!
Secondly, please refer to the StackOverflow link/question.
function onSubmit(e) {
Logger.log(JSON.stringify(e.values))
const sheet = SpreadsheetApp.getActiveSpreadsheet().getSheetByName(`onSubmit`)
const [timestamp,emailAddress,companyName,_,phoneNumber,firstName,lastName,locations,city,state,zipCode,dateRequested,...rest] = e.values;
locations.split(`,`).forEach(i => sheet.appendRow([firstName, lastName, i.trim(), city, state, zipCode, dateRequested]))
}
Finally, I am getting an error in the code. Also, if I wanted to add new columns or questions to the Google form would that be as simple as just add the header's text with the other constants in the script?