I want to get an email address

Asked 2 years ago, Updated 2 years ago, 42 views

I would like to obtain an email address using Google form.
"However, if ""Settings"" → ""General"" → ""Collect email addresses,""
" I have to enter an address one by one, so I want to avoid it.

Therefore, you must log in to Google when you answer.
I figured out how to get my email address (login ID) from the information I had when I logged in.

However, although you can get your own address (*),
You cannot obtain addresses for non-self users.
I want you to tell me how to get addresses for people other than yourself

*You can get your own address by registering as a trigger using the script below.

function submitForm(e){
    Logger.log(Session.getEffectiveUser().getEmail());
}

google-apps-script

2022-09-30 18:13

1 Answers

"Is ""View"" → ""View Manifest File"" listed below?"

{
  ...
  "oauthScopes": [
    "https://www.googleapis.com/auth/userinfo.email"
  ],
  ...
}

getEffectiveUser() requires authorization and additional scopes.

getEffectiveUser() Reference
How to add scope


2022-09-30 18:13

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.