I work for a charter school and when I get new students I have to fill out an equipment request form for the student through Google Forms. I would like to be able to automatically submit a response without having to fill the form out every time. I already have all the information about the student that I would need in a Google Sheet.
I do not have edit access to the Form and can only use Google app script for coding because I do not have server access or admin access on my work laptop. So this is really my only option for automation.
So far I have been able to make a fetch call with the Form url and an object using the entryIDs for the questions.
const obj = {
"entry.1111": tName,
"entry.2222": sFirst,
"entry.3333": sLast,
"entry.4444": 'Option 1', //multiple answer question
"entry.5555": 'yes',
"entry.6666": 'yes',
"entry.7777": 'minor',
"entry.8888": 'initial'
}
const options = {
'method': 'post',
'payload': obj
}
UrlFetchApp.fetch(url,options)
This works as long as I do not need to include more than one answer per question, but for some students I need to do just that. If I try to send a string like "Option 1, Option 2" the script fails.
Edit: My code does not have the comment in the object.