Saturday, July 30, 2016

Get Google Group members using GAM and python

You can get a list of Google Groups members using GAM by running this following command:

gam print group-members group <group_email>

The results is a csv-style list of group members:

status,group,email,role,type,id
ACTIVE,<group_email>,<user_email>,MEMBER,USER,110853351795805057050
...

You can take advantage of python to filter the result and put all the user email addresses into a list:

Note: before using the python script, you have to make sure your GAM installation is up and running.