I have a Google form, from which I want to add the Email
field into a Google group. Currently, the form responses are recorded in a spreadsheet (on Google drive) and also, an automatic response is sent to their email id acknowledging their registration. I also need to add that email id into a Google group as a member.
I tried this, but it did not work:
function addMember(f) {
var email = "";
for (var field in f.namedValues) {
if (field == 'Email Address') {
email = f.namedValues[field].toString();
}
}
var options = {
"email": email,
"role": "MEMBER"
};
var result = UrlFetchApp.fetch("googleapis.com/admin/directory/v1/groups/…", options);
}