Wouldn't a more simple way of doing this be done using functions in the actual sheet?
Up: =MROUND(A1+0.25;0.5)
Down: =MROUND(A1-0.25;0.5)
I would assume that having another column added to the spreadsheet that takes the Google Forms input and performs the rounding function on it, then use Apps Script to email the data would be easier than than trying to do it all in a script.
Yes, you can trigger an Apps Script function with an HTTPS POST request. You'll need to add a doPost()
function to a script file. The doPost()
function can also receive data from the POST request. If you want to receive data into the doPost()
function, add a variable name inside of the parenthesis:
doPost(e) {
// . . code here . .
};
The documentation typically shows a variable named e
inside of the parenthesis, but you can use any name that you want.
If you need to send a POST request from an Apps Script function, you can use:
UrlFetchApp.fetch()
The default type of request is a GET request, so you will need to use advanced options, and explicitly designate a POST request.
Google Apps Script Documentation - UrlFetchApp.fetch()
In order for the Apps Script project to be available, it must be published. In the script editor, click the "Publish" menu, and choose "Deploy as Web App". There are two versions of a Web App, the development version, and the "production" version. The development version has "dev" on the end of the URL. The production version has "exec" on the end of the URL.
The "exec" version of the Apps Script URL is what you must use for the URL in your POST request to your Apps Script project.
If you want to return something from the Apps Script web app, then you must use Content Service.
You can get more information from the following Stack Overflow post:
Call a custom GAS function from an external URL
Best Answer
Direct answer.
To create an installable triggers, open Script Editor (Tools > Script Editor in Spreadsheets or Documents, or in "three dots" menu in Google Forms). Within it go to Edit > Current project's triggers. A pop-up window will appear, listing the current triggers (if any) and prompting you to create a new one.
"On open" in a form
The above will not help because what you are trying to do is impossible. For a form "on open" means the form is opened for editing. This is true for both simple and installable triggers. There is no trigger for "someone opened the form to fill it up. You cannot modify the contents of the form based on who opened it.
Other remarks
This is incorrect. I use simple onOpen triggers to create custom menu items in shared spreadsheets, and they work for every user with access to the spreadsheet.