Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Retrieve the e-mail address of a Google Form respondent without asking for their e-mail address in the form

The scenario goes:

  1. Via email, a Google Form is sent to a respondent.
  2. Via this sent email, the respondent answers the form and sends their response. This form has no email address field.
  3. 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).

like image 474
brain56 Avatar asked Oct 17 '14 13:10

brain56


1 Answers

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.

like image 86
Cameron Roberts Avatar answered Oct 17 '22 04:10

Cameron Roberts