Force email receipt for Form submission in Google Script - google-apps-script

Is there a method in Google Script to force a receipt to be sent via email with a user's form submission? I see there is a way to do it within the Form itself, but there doesn't appear to be a way to do this in the API.

Related

Using a custom script on Google Forms

I trying to create a custom script to collect the email filled on field (within my Google Form) and send an email when the user clicks on submit button.
Is it possible do it?
note: I don't want to collect the email address of who's filling the form.. I want just collect the email typed on field and send an email.
You won't be able to send the user an email if their email doesn't show up on a Spreadsheet. You're going to have to collect some data in this case, otherwise you won't be able to send them an email.
Use MailApp from gScript to send an email. Pretty simple to do with an onSubmit function.

How do I get the active response in a Google Apps Script bound to a form?

I'm writing a script within (bound to) a Google Form. The idea here is to have the respondent enter their email address in the form (that's the only field in the form) and then make a copy of a spreadsheet (based on a template) and email it to them.
The script is triggered by the submission of the form. At the moment I'm wondering what the easiest way would be to grab that email address out of their response. I have gotten as far as figuring out that it's available within FormApp.getActiveForm(), but I can't seem to find a "getActiveResponse()" method. How do I grab that email address they just entered, without scrolling through every response? If there was a getActiveResponse, then I would just grab the contents of Item 1.
The Form submit event has the FormResponse property. This property has the method getRespondentEmail()
If the script is triggered by the submit event, you should be able to fetch the email address from there.

Google Apps Script - Can I send email from another account

I have just implement a simple function to send email automatic when a google form is submitted, with my current account.
When I sign in with other google account and submit this form. I recieve an email with my account (not account is signed). Is there any way to send with the account is signed?
Edit: I think I misunderstood your question...
2 things to know:
When a script sends an email using a triggered function ( a form submit trigger in this case) the mail will always be sent by the account of the creator of the trigger.
As explained below, to get the email address of the user submitting a form you must be part of a google-apps domain.
If you are using your form in a GAFE or business Google Apps account then you can use the getRespondentEmail() method but as mentioned in the documentation this does not work for normal Gmail accounts.

Any way to validate a Google form input?

I want to collect and validate a value (PIN) in a Google Form. The Form has 2 pages, and I'd like the validation to affect form navigation:
If PIN matched with a value in Column N of the response sheet, continue to page 2 of the form
If PIN not matched, Do not continue.
Can this be done with Google Apps Script?
You are not able to create this type of dynamic form using the Google Forms Service, because there is no interaction between the service and scripts during form entry, except upon Form Submission. In the case of a multi-page form, a script has no way to know that a user has completed one page and gone on to another.
You could achieve this using the HtmlService or UiService, by writing your own form.
Not sure you can do this with Google Forms and Apps Script.
But I have done exactly this with UiApp/Html Service in Apps Script. I used it for a light-duty user authentication.

Google Apps Script - Send email as user submitting form data

Using Google Apps for business, I have a form that company users access on a google site. The users completes the form and submits. onSubmit, a script runs, collects the data and puts into a PDF and sends an email to me for review.
Right now when the email is sent, it comes to my inbox as me sending to me. I'd like to have it send as the user submitting the form. Can anyone point me in the direction to send as the user submitting the form.
permissions are set as followed:
The spreadsheet sharing option has anyone at company can find / view.
It's deployed as "execute the apps as:" User accessing the web app. And anyone at the company can access the app.
thoughts?
You can replace the form with an HtmlService or UiApp version that runs as the user, and then the email will come from them.
Assuming your are using Google Forms, I don't believe the function/script being run onSubmit is being run by the user who fills out the form, its being run by the owner of the script (you). As #Corey G stated, you can use HtmlService or UIApp to create a form, but takes much more time to create the form itself.