The scenario goes:
- Via email, a Google Form is sent to a respondent.
- Via this sent email, the respondent answers the form and sends their response. This form has no email address field.
- I need to retrieve the respondents e-mail address and add it to the spreadsheet where the Google Form responses are recorded.
Via Google Apps script, is it possible to retrieve the respondent's e-mail address in this manner? For specific reasons, I am not allowed to inquire the respondent's e-mail address. Retrieving the e-mail address in this manner also serves as verification so that it is verifiable which of the e-mail addresses I sent the form to have a response.
I am aware that if you have a field which contains the user's e-mail address, this is very do-able. There is even a tutorial specifically about it. However, I haven't seen a guide for the use case described above.
I have attempted using Session.getActiveUser().getEmail()
. However, it seems that it only retrieves my own e-mail address (as it considers me, the person viewing the spreadsheet, as the active user).
This can only be done if you are using Google Apps for Business, Google Apps for Education, or Google Apps for Your Domain, and are having users on your domain fill out the form. In that case, you can use getRespondentEmail()
to retrieve the submitter's email address.
If your situation doesn't meet the requirement above, Google does not expose the submitter's email address to you and your only option is to prompt them for it on the form.
In the Form Designer, go to settings. Check Collect Email Address
来源:https://stackoverflow.com/questions/26425627/retrieve-the-e-mail-address-of-a-google-form-respondent-without-asking-for-their