Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Google Apps Script to find all members in a group
function doGet(e){
var input = e.parameter.email;
Logger.log(input);
if (input == "")
{
return HtmlService.createHtmlOutput("<h2>fail</h2>")
}
return HtmlService.createHtmlOutput(listGroupMembers(input))
};
function listGroupMembers(input) {
var group = GroupsApp.getGroupByEmail(input);
var s = "<div align='center'><font color='fa0029' family='ubuntu'><br><br><b>" + group.getEmail() + '</b><br><br>';
var users = group.getUsers();
for (var i = 0; i < users.length; i++) {
var user = users[i];
s = s + user.getEmail() + "<br> ";
}
s = s + "<br><br><b>Total Users: " + users.length;
s = s + "<br><button onclick='goBack()'>Go Back</button><script>function goBack() {window.history.back()}</script>";
Logger.log(s);
return s;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.