In order to use and run AutoGroups, you need to create a Google Spreadsheet™. The spreadsheet is used to configure the group configurations, and then a periodic trigger applies the group configurations. The spreadsheet can be shared with multiple users for edition, but only one user (who must be an administrator of the Google Workspace™ domain) configures the trigger. The trigger runs on the behalf of this user.
Go in Google Drive™ and create a new spreadsheet (or just use this link to directly create a new spreadsheet!),
In the spreadsheet, select the menu entry "Extensions > AutoGroups > Install auto-groups sheet...",
This will take a few seconds to insert a new sheet in your spreadsheet that will look as below. In the top-left corner, you should see the domain name of your Google Workspace account.
Before going further, it is important to understand that a user can have one of 4 different roles in a Google group:
OWNER: The user is responsible for the administration of the group. In addition to receiving emails, they can change the configuration of the group.
MANAGER: This is an intermediate role between OWNER and MEMBER, which is typically (but rarely) used for moderation.
MEMBER: The user receives emails for the group.
NONE: The user is not a member of the group.
A given group will typically have a few OWNERS and one, several or many MEMBERS.
You can now configure one group per row in your spreadsheet. You can leave empty rows (that are ignored) and add new rows at the bottom of the spreadsheet. You can delete some columns if they are not useful to you.
For each group, you can fill the following information:
Group: This is the full email address of the group (like "mygroup@mydomain.com"),
Role definition: This is a JavaScript expression (with a return statement) specifying the role to assign to each user. See the section "Role definition" below for more details.
Force: You can list email addresses in each of these columns (separated by line returns, type "ALT+Enter" while editing a cell to insert a new line). These addresses will be assigned the given role in the group, whatever
Keep owners: If you check this box, AutoGroups will never remove existing owners for the group (e.g. that have been manually added through the Google Groups interface)
Keep all: If you check this box, AutoGroups will never remove existing members for the group (whatever their role, which will be preserved.)
Keep unknown: If you check this box, AutoGroups will never remove email addresses that are not found in the Google Workspace directory from the group. These might be either deleted account of your Google Workspace domain, or email addresses from other domains.
Disabled: If you check this box, AutoGroups will stop updating this group.
The role definition for each group is a JavaScript expression that must return a role for every user of the directory of the Google Workspace domain for the given group. The expression is evaluated in a context where the variable $user is bound to the user object of the current user (all the fields are defined on this page.) The expression must return either:
A string which can be a one of "NONE", "MEMBER", "MANAGER" or "OWNER" specifying the role of the user (lowercase is also OK),
A boolean: true for "MEMBER" or false for "NONE.
Define a group with all users of the domain as members:
return 'MEMBER";
Define a group with all users of the domain as members, and all users whose email address starts by 'a' as owners:
if ($user.primaryEmail.startsWith('a')) return 'OWNER'; else return 'MEMBER';
Define a group with all users from a given OU as members:
return $user.orgUnitPath.startsWith('/Foo');
You can run a one-off update of the groups by selecting the menu entry "Extensions > AutoGroups > Update groups now". You can see the results in the column "report".
Once this works well, you can setup a trigger to periodically run the update by selecting the menu entry "Extensions > AutoGroups > Configure periodic updates...".