'Capture the potential subscriber's Name, Email id in a google form and then programmatically add it to the Google group

I want to write a code for Google Apps Script, so that whenever a entry (email) from google form is saved in a google sheet, that mail address is added to a google group.



Solution 1:[1]

The GroupsApp only allows read methods. You need to use the Admin Directory API for this. In short, it requires the following steps:

  1. Creating a service account on GCP
  2. Importing the OAuth2 libarary
  3. Enabling domain-wide delegation
  4. Adding the required scopes in the admin console
  5. Impersonating a super-user
  6. Enable the Admin SDK API

I wrote a detailed article, it's the example number three.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Dmitry Kostyuk