-
Notifications
You must be signed in to change notification settings - Fork 88
Collections of Users
- Python Regular Expressions Match function
- Definitions
- List quoting rules
-
User Type Entity
- All non-suspended Users
- All suspended Users
- All non-suspended and suspended Users
- A single User
- A list of Users
- The admin user referenced in oauth2.txt
- Users in the domains
<DomainNameList>
- Users directly in the group
<GroupItem>
- Users directly in the groups
<GroupList>
- Users directly and indirectly in the group
<GroupItem>
- Users directly and indirectly in the groups
<GroupList>
- Selected Users from groups
- Users directly in the Cloud Identity group
<GroupItem>
- Users directly in the Cloud Identity groups
<GroupList>
- Selected Users from Cloud Identity groups
- Users directly in the Organization Unit
<OrgUnitItem>
- Users in the Organization Unit
<OrgUnitItem>
and all of its sub Organization Units - Users directly in the Organization Units
<OrgUnitList>
- Users in the Organization Units
<OrgUnitList>
and all of their sub Organization Units - All of the students and teachers in the courses specified in
<CourseIDList>
- All of the students in the courses specified in
<CourseIDList>
- All of the teachers in the courses specified in
<CourseIDList>
- All Users with any of the licenses specified in
<SKUIDList>
- Users that match a query
- Users that match any query in a list of queries
- Users in a flat file/Google Doc/Google Cloud Storage Object
- Selected users in a CSV file/Google Sheet/Google Doc/Google Cloud Storage Object
- Users from groups/OUs/courses in a flat file/Google Doc/Google Cloud Storage Object
- Users from groups/OUs/courses in a CSV file/Google Sheet/Google Doc
- Users directly in or from groups/OUs/courses in a CSV file/Google Sheet/Google Doc/Google Cloud Storage Object
- Users from data fields identified in a
csvkmd
argument
- Examples using CSV files and Google Sheets to update the membership of a group
- Examples using CSV files to print users from groups
- Examples using multiple queries
<StorageBucketName> ::= <String>
<StorageObjectName> ::= <String>
<StorageBucketObjectName> ::=
https://storage.cloud.google.com/<StorageBucketName>/<StorageObjectName>|
https://storage.googleapis.com/<StorageBucketName>/<StorageObjectName>|
gs://<StorageBucketName>/<StorageObjectName>|
<StorageBucketName>/<StorageObjectName>
<UserGoogleDoc> ::=
<EmailAddress> <DriveFileIDEntity>|<DriveFileNameEntity>|(<SharedDriveEntity> <SharedDriveFileNameEntity>)
<SheetEntity> ::= <String>|id:<Number>
<UserGoogleSheet> ::=
<EmailAddress> <DriveFileIDEntity>|<DriveFileNameEntity>|(<SharedDriveEntity> <SharedDriveFileNameEntity>) <SheetEntity>
<DriveFileID> ::= <String>
<DriveFileURL> ::=
https://drive.google.com/open?id=<DriveFileID>
https://drive.google.com/drive/files/<DriveFileID>
https://drive.google.com/drive/folders/<DriveFileID>
https://drive.google.com/drive/folders/<DriveFileID>?resourcekey=<String>
https://drive.google.com/file/d/<DriveFileID>/<String>
https://docs.google.com>/document/d/<DriveFileID>/<String>
https://docs.google.com>/drawings/d/<DriveFileID>/<String>
https://docs.google.com>/forms/d/<DriveFileID>/<String>
https://docs.google.com>/presentation/d/<DriveFileID>/<String>
https://docs.google.com>/spreadsheets/d/<DriveFileID>/<String>
<DriveFileItem> ::= <DriveFileID>|<DriveFileURL>
<DriveFileList> ::= "<DriveFileItem>(,<DriveFileItem>)*"
<DriveFileName> ::= <String>
<DriveFileIDEntity> ::=
(<DriveFileItem>)|(id( |:)<DriveFileItem>)|(ids( |:)<DriveFileList>)
<DriveFileNameEntity> ::=
(drivefilename <DriveFileName>)|(drivefilename:<DriveFileName>)|
(anydrivefilename <DriveFileName>)|(anydrivefilename:<DriveFileName>)
<SharedDriveID> ::= <String>
<SharedDriveName> ::= <String>
<SharedDriveIDEntity> ::= (teamdriveid <DriveFileItem>) | (teamdriveid:<DriveFileItem>)
<SharedDriveNameEntity> ::= (teamdrive <SharedDriveName>) | (teamdrive:<SharedDriveName>)
<SharedDriveFileNameEntity> ::= (teamdrivefilename <DriveFileName>) | (teamdrivefilename:<DriveFileName>)
<SharedDriveEntity> ::=
<SharedDriveIDEntity> |
<SharedDriveNameEntity>
<UserTypeEntity> ::=
(all users|users_ns|users_susp|users_ns_susp)|
(user <UserItem>)|
(users <UserList>)|
(oauthuser)
(domains|domains_ns|domains_susp <DomainNameList>)|
(group|group_ns|group_susp|group_inde <GroupItem>)|
(groups|groups_ns|groups_susp|groups_inde <GroupList>)|
(group_inde <GroupItem>)|(groups_inde <GroupList>)|
(group_users|group_users_ns|group_users_susp <GroupList>
[members] [managers] [owners]
[primarydomain] [domains <DomainNameList>] [recursive|includederivedmembership] end)|
(group_users_select <GroupList>
[members] [managers] [owners]
[notsuspended|suspended] [notarchived|archived]
[primarydomain] [domains <DomainNameList>] [recursive|includederivedmembership] end)|
(ou|ou_ns|ou_susp <OrgUnitItem>)|
(ou_and_children|ou_and_children_ns|ou_and_children_susp <OrgUnitItem>)|
(ous|ous_ns|ous_susp <OrgUnitList>)|
(ous_and_children|ous_and_children_ns|ous_and_children_susp <OrgUnitList>)|
(courseparticipants <CourseIDList>)|
(students <CourseIDList>)|
(teachers <CourseIDList>)|
(license|licenses|licence|licences <SKUIDList>)|
(query <QueryUser>)|
(queries <QueryUserList>)|
(file
((<FileName> [charset <Charset>])|
(gdoc <UserGoogleDoc>)|
(gcsdoc <StorageBucketObjectName>))
[delimiter <Character>])|
(csvfile
((<FileName>(:<FieldName>)+ [charset <Charset>] )|
(gsheet(:<FieldName>)+ <UserGoogleSheet>)|
(gdoc(:<FieldName>)+ <UserGoogleDoc>)|
(gcscsv(:<FieldName>)+ <StorageBucketObjectName>)|
(gcsdoc(:<FieldName>)+ <StorageBucketObjectName>))
[warnifnodata] [columndelimiter <Character>] [noescapechar <Boolean>][quotechar <Character>]
[endcsv|(fields <FieldNameList>)]
(matchfield|skipfield <FieldName> <RegularExpression>)*
[delimiter <Character>])|
(datafile
users|groups|groups_ns|groups_susp|groups_inde|ous|ous_ns|ous_susp|
ous_and_children|ous_and_children_ns|ous_and_children_susp|
courseparticipants|students|teachers
((<FileName> [charset <Charset>])|
(gdoc <UserGoogleDoc>)|
(gcsdoc <StorageBucketObjectName>))
[delimiter <Character>])|
(csvdatafile
users|groups|groups_ns|groups_susp|groups_inde|ous|ous_ns|ous_susp|
ous_and_children|ous_and_children_ns|ous_and_children_susp|
courseparticipants|students|teachers
((<FileName>(:<FieldName>)+ [charset <Charset>] )|
(gsheet(:<FieldName>)+ <UserGoogleSheet>)|
(gdoc(:<FieldName>)+ <UserGoogleDoc>)|
(gcscsv(:<FieldName>)+ <StorageBucketObjectName>)|
(gcsdoc(:<FieldName>)+ <StorageBucketObjectName>))
[warnifnodata] [columndelimiter <Character>] [noescapechar <Boolean>][quotechar <Character>]
[endcsv|(fields <FieldNameList>)]
(matchfield|skipfield <FieldName> <RegularExpression>)*
[delimiter <Character>])|
(csvkmd
users|groups|groups_ns|groups_susp|groups_inde|ous|ous_ns|ous_susp|
ous_and_children|ous_and_children_ns|ous_and_children_susp|
courseparticipants|students|teachers
((<FileName>|
(gsheet <UserGoogleSheet>)|
(gdoc <UserGoogleDoc>)|
(gcscsv <StorageBucketObjectName>)|
(gcsdoc <StorageBucketObjectName>))
[charset <Charset>] [columndelimiter <Character>] [noescapechar <Boolean>][quotechar <Character>] [fields <FieldNameList>])
keyfield <FieldName> [keypattern <RegularExpression>] [keyvalue <String>] [delimiter <Character>]
subkeyfield <FieldName> [keypattern <RegularExpression>] [keyvalue <String>] [delimiter <Character>]
(matchfield|skipfield <FieldName> <RegularExpression>)*
[datafield <FieldName>(:<FieldName>)* [delimiter <Character>]])
(csvdata <FieldName>(:<FieldName>*))
Items in a list can be separated by commas or spaces; if an item itself contains a comma, a space or a single quote, special quoting must be used. Typically, you will enclose the entire list in double quotes and quote each item in the list as detailed below.
- Items, separated by commas, without spaces, commas or single quotes in the items themselves
"item,item,item"
- Items, separated by spaces, without spaces, commas or single quotes in the items themselves
"item item item"
- Items, separated by commas, with spaces, commas or single quotes in the items themselves
"'it em','it,em',\"it'em\""
- Items, separated by spaces, with spaces, commas or single quotes in the items themselves
"'it em' 'it,em' \"it'em\""
Typical places where these rules apply are lists of OUs and Contact Groups.
Use these options to select users for GAM commands.
all users
all users_ns
all users_susp
all users_ns_susp
user <UserItem>
users <UserList>
oauthuser
-
domains|domains_ns|domains_susp <DomainNameList>
-
domains
- All users -
domains_ns
- Non-suspended users -
domains_susp
- Suspended users
-
-
group|group_ns|group_susp <GroupItem>
-
group
- All user members -
group_ns
- Non-suspended user members -
group_susp
- Suspended user members
-
-
groups|groups_ns|groups_susp <GroupList>
-
groups
- All user members -
groups_ns
- Non-suspended user members -
groups_susp
- Suspended user members
-
* `group_inde` - All user members including those from all subgroups
* `groups_inde` - All user members including those from all subgroups
-
group_users|group_users_ns|group_users_susp <GroupList> [members] [managers] [owners] [primarydomain] [domains <DomainNameList>] [recursive|includederivedmembership] end
-
group_users
- All user members -
group_users_ns
- Non-suspended user members -
group_users_susp
- Suspended user members -
[members] [managers] [owners]
- The desired roles; if roles are not specified, all roles are included -
primarydomain
- Select Users from the primary domain -
domains <DomainNameList>
- Select Users from the list of domains -
recursive
- Select Users from all subgroups; do not select Users from a member of type CUSTOMER (all users in a domain); GAM performs the recursion -
includederivedmembership
- Select Users from all subgroups; do select Users from a member of type CUSTOMER (all users in a domain); the API performs the recursion but produces inconsistent results, use with caution -
end
- Terminate the selection
-
-
group_users_select <GroupList> [members] [managers] [owners] [notsuspended|suspended] [notarchived|archived] [primarydomain] [domains <DomainNameList>] [recursive|includederivedmembership] end
-
[members] [managers] [owners]
- The desired roles; if roles are not specified, all roles are included - By default, memebers of all statuses are included
-
notsuspended
- Do not include suspended users, this is common -
suspended
- Only include suspended users, this is not common but allows creating groups that allow easy identification of suspended users -
notarchived
- Do not include archived members -
archived
- Only include archived members, this is not common but allows creating groups that allow easy identification of archived users -
notsuspended notarchived
- Do not include suspended and archived members -
suspended archived
- Include only suspended or archived members -
notsuspended archived
- Only include archived members, this is not common but allows creating groups that allow easy identification of archived users -
suspended notarchived
- Only include suspended users, this is not common but allows creating groups that allow easy identification of suspended users
-
-
primarydomain
- Select Users from the primary domain -
domains <DomainNameList>
- Select Users from the list of domains -
recursive
- Select Users from all subgroups; do not select Users from a member of type CUSTOMER (all users in a domain); GAM performs the recursion -
includederivedmembership
- Select Users from all subgroups; do select Users from a member of type CUSTOMER (all users in a domain); the API performs the recursion but produces inconsistent results, use with caution -
end
- Terminate the selection
-
-
cigroup <GroupItem>
-
cigroup
- All user members
-
-
cigroups <GroupList>
-
cigroups
- All user members
-
-
cigroup_users <GroupList> [members] [managers] [owners>] [recursive] end
-
cigroup_users
- All user members -
[members] [managers] [owners]
- The desired roles; if roles are not specified, all roles are included -
recursive
- Select Users from all subgroups; do not select Users from a member of type CUSTOMER (all users in a domain); GAM performs the recursion -
end
- Terminate the selection
-
-
ou|ou_ns|ou_susp <OrgUnitItem>
-
ou
- All users -
ou_ns
- Non-Suspended users -
ou_susp
- Suspended users
-
-
ou_and_children|ou_and_children_ns|ou_and_children_susp <OrgUnitItem>
-
ou_and_children
- All users -
ou_and_children_ns
- Non-suspended users -
ou_and_children_susp
- Suspended users
-
-
ous|ous_ns|ous_susp <OrgUnitList>
- Users directly in the Organization Units<OrgUnitList>
-
ous
- All users -
ous_ns
- Non-suspended users -
ous_susp
- Suspended users
-
<OrgUnitList>
may require special quoting based on whether the OUs contain spaces, commas or single quotes.
For quoting rules, see: List Items
-
ous_and_children|ous_and_children_ns|ous_and_children_susp <OrgUnitList>
- Users in the Organization Units<OrgUnitList>
and all of their sub Organization Units-
ous_and_children
- All users -
ous_and_children_ns
- Non-suspended users -
ous_and_children_susp
- Suspended users
-
<OrgUnitList>
may require special quoting based on whether the OUs contain spaces, commas or single quotes.
For quoting rules, see: List Items
courseparticipants <CourseIDList>
students <CourseIDList>
teachers <CourseIDList>
license|licenses|licence|licences <SKUIDList>
query <QueryUser>
See https://developers.google.com/admin-sdk/directory/v1/guides/search-users
queries <QueryUserList>
See https://developers.google.com/admin-sdk/directory/v1/guides/search-users
<QueryUserList>
may require special quoting based on whether the queries contain spaces, commas or single quotes.
- Surround
<QueryCrOSList>
with" "
- Surround each query with
\" \"
, separate the queries with commas.
queries "\"orgUnitPath='/Path/To/OU 1' isSuspended=False\",\"orgUnitPath='/Path/To/OU 2' isSuspended=False\",\"orgUnitPath='/Path/To/OU 3' isSuspended=False\""
Note that the results are all users who match one or more of the queries. In other words this is "OR" logic, and you get the union of all matching results.
For quoting rules, see: List Items
file
((<FileName> [charset <Charset>])|
(gdoc <UserGoogleDoc>)|
(gcsdoc <StorageBucketObjectName>))
[delimiter <Character>]
-
<FileName>
- A flat file containing a single User per row-
charset <Charset>
- The character aset of the file if it isn't UTF-8
-
-
gdoc <UserGoogleDoc>
- A Google Doc containing a single User per row -
gcsdoc <StorageBucketObjectName>
- A Google Cloud Storage Bucket Object containing a single User per row -
delimiter <Character>
- There are multiple Users per row separated by<Character>
; if not specified, there is single user per row
csvfile
((<FileName>(:<FieldName>)+ [charset <Charset>] )|
(gsheet(:<FieldName>)+ <UserGoogleSheet>)|
(gdoc(:<FieldName>)+ <UserGoogleDoc>)|
(gcscsv(:<FieldName>)+ <StorageBucketObjectName>)|
(gcsdoc(:<FieldName>)+ <StorageBucketObjectName>))
[warnifnodata] [columndelimiter <Character>] [noescapechar <Boolean>][quotechar <Character>]
[endcsv|(fields <FieldNameList>)]
(matchfield|skipfield <FieldName> <RegularExpression>)*
[delimiter <Character>]
-
<FileName>(:<FieldName>)+
- A CSV file and the one or more columns that contain Users-
charset <Charset>
- The character aset of the file if it isn't UTF-8
-
-
gsheet(:<FieldName>)+ <UserGoogleSheet>
- A Google Sheet and the one or more columns that contain Users -
gdoc(:<FieldName>)+ <UserGoogleDoc>
- A Google Doc and the one or more columns that contain Users -
gcscsv(:<FieldName>)+ <StorageBucketObjectName>
- A Google Cloud Storage Bucket Object and the one or more columns that contain Users -
gcsdoc(:<FieldName>)+ <StorageBucketObjectName>
- A Google Cloud Storage Bucket Object and the one or more columns that contain Users -
warnifnodata
- Issue message 'No CSV file data found' and exit with return code 60 if there is no data selected from the file -
columndelimiter <Character>
- Columns are separated by<Character>
; if not specified, the value ofcsv_input_column_delimiter
fromgam.cfg
will be used -
noescapechar <Boolean>
- Should\
be ignored as an escape character; if not specified, the value ofcsv_input_no_escape_char
fromgam.cfg
will be used -
quotechar <Character>
- The column quote character is<Character>
; if not specified, the value ofcsv_input_quote_char
fromgam.cfg
will be used -
endcsv
- Use this option to signal the end of the csvfile parameters in the case that the next argument on the command line isfields
but is specifying the output field list for the command not column headings -
fields <FieldNameList>
- The column headings of a CSV file that does not contain column headings -
(matchfield|skipfield <FieldName> <RegularExpression>)*
- The criteria to select rows from the CSV file; can be used multiple times; if not specified, all rows are selected -
delimiter <Character>
- There are multiple Users per column separated by<Character>
; if not specified, there is single user per column
datafile
users|groups|groups_ns|groups_susp|groups_inde|ous|ous_ns|ous_susp|
ous_and_children|ous_and_children_ns|ous_and_children_susp|
courseparticipants|students|teachers
((<FileName> [charset <Charset>])|
(gdoc <UserGoogleDoc>)|
(gcsdoc <StorageBucketObjectName>))
[delimiter <Character>]
-
users|groups|groups_ns|groups_susp|groups_inde|ous|ous_ns|ous_susp|ous_and_children|ous_and_children_ns|ous_and_children_susp|courseparticipants|students|teachers
- The type of item in the file -
<FileName>
- A flat file containing rows of the type of item specified-
charset <Charset>
- The character aset of the file if it isn't UTF-8
-
-
gdoc <UserGoogleDoc>
- A Google Doc containing rows of the type of item specified -
gcsdoc <StorageBucketObjectName>
- A Google Cloud Storage Bucket Object containing rows of the type of item specified -
delimiter <Character>
- There are multiple items per row separated by<Character>
; if not specified, there is single item per row
csvdatafile
users|groups|groups_ns|groups_susp|groups_inde|ous|ous_ns|ous_susp|
ous_and_children|ous_and_children_ns|ous_and_children_susp|
courseparticipants|students|teachers
((<FileName>(:<FieldName>)+ [charset <Charset>] )|
(gsheet(:<FieldName>)+ <UserGoogleSheet>)|
(gdoc(:<FieldName>)+ <UserGoogleDoc>)|
(gcscsv(:<FieldName>)+ <StorageBucketObjectName>)|
(gcsdoc(:<FieldName>)+ <StorageBucketObjectName>))
[warnifnodata] [columndelimiter <Character>] [noescapechar <Boolean>][quotechar <Character>]
[endcsv|(fields <FieldNameList>)]
(matchfield|skipfield <FieldName> <RegularExpression>)*
[delimiter <Character>]
-
users|groups|groups_ns|groups_susp|groups_inde|ous|ous_ns|ous_susp|ous_and_children|ous_and_children_ns|ous_and_children_susp|courseparticipants|students|teachers
- The type of item in the file -
<FileName>(:<FieldName>)+
- A CSV file and the one or more columns contain the type of item specified-
charset <Charset>
- The character aset of the file if it isn't UTF-8
-
-
gsheet(:<FieldName>)+ <UserGoogleSheet>
- A Google Sheet and the one or more columns contain the type of item specified -
gdoc(:<FieldName>)+ <UserGoogleDoc>
- A Google Doc and the one or more columns contain the type of item specified -
gcscsv(:<FieldName>)+ <StorageBucketObjectName>
- A Google Cloud Storage Bucket Object and the one or more columns contain the type of item specified -
gcsdoc(:<FieldName>)+ <StorageBucketObjectName>
- A Google Cloud Storage Bucket Object and the one or more columns contain the type of item specified -
warnifnodata
- Issue message 'No CSV file data found' and exit with return code 60 if there is no data selected from the file -
columndelimiter <Character>
- Columns are separated by<Character>
; if not specified, the value ofcsv_input_column_delimiter
fromgam.cfg
will be used -
noescapechar <Boolean>
- Should\
be ignored as an escape character; if not specified, the value ofcsv_input_no_escape_char
fromgam.cfg
will be used -
quotechar <Character>
- The column quote character is<Character>
; if not specified, the value ofcsv_input_quote_char
fromgam.cfg
will be used -
endcsv
- Use this option to signal the end of the csvfile parameters in the case that the next argument on the command line isfields
but is specifying the output field list for the command not column headings -
fields <FieldNameList>
- The column headings of a CSV file that does not contain column headings -
(matchfield|skipfield <FieldName> <RegularExpression>)*
- The criteria to select rows from the CSV file; can be used multiple times; if not specified, all rows are selected -
delimiter <Character>
- There are multiple Users per column separated by<Character>
; if not specified, there is single user per column
Users directly in or from groups/OUs/courses in a CSV file/Google Sheet/Google Doc/Google Cloud Storage Object
csvkmd
users|groups|groups_ns|groups_susp|groups_inde|ous|ous_ns|ous_susp|
ous_and_children|ous_and_children_ns|ous_and_children_susp|
courseparticipants|students|teachers
((<FileName>|
(gsheet <UserGoogleSheet>)|
(gdoc <UserGoogleDoc>)|
(gcscsv <StorageBucketObjectName>)|
(gcsdoc <StorageBucketObjectName>))
[charset <Charset>] [columndelimiter <Character>] [noescapechar <Boolean>][quotechar <Character>] [fields <FieldNameList>])
keyfield <FieldName> [keypattern <RegularExpression>] [keyvalue <String>] [delimiter <Character>]
subkeyfield <FieldName> [keypattern <RegularExpression>] [keyvalue <String>] [delimiter <Character>]
(matchfield|skipfield <FieldName> <RegularExpression>)*
[datafield <FieldName>(:<FieldName>)* [delimiter <Character>]]
-
users|groups|groups_ns_|groups_susp|groups_inde|ous|ous_ns|ous_susp|ous_and_children|ous_and_children_ns|ous_and_children_susp|courseparticipants|students|teachers
- The type of item in the file -
<FileName>
- A CSV file containing rows with columns of the type of item specified-
charset <Charset>
- The character aset of the file if it isn't UTF-8
-
-
gsheet <UserGoogleSheet>
- A Google Sheet containing rows with columns of the type of item specified -
gdoc <UserGoogleDoc>
- A Google Doc containing rows with columns of the type of item specified -
gcscsv <StorageBucketObjectName>
- A Google Cloud Storage Bucket Object with columns of the type of item specified -
gcsdoc <StorageBucketObjectName>
- A Google Cloud Storage Bucket Object with columns of the type of item specified -
warnifnodata
- Issue message 'No CSV file data found' and exit with return code 60 if there is no data selected from the file -
columndelimiter <Character>
- Columns are separated by<Character>
; if not specified, the value ofcsv_input_column_delimiter
fromgam.cfg
will be used -
noescapechar <Boolean>
- Should\
be ignored as an escape character; if not specified, the value ofcsv_input_no_escape_char
fromgam.cfg
will be used -
quotechar <Character>
- The column quote character is<Character>
; if not specified, the value ofcsv_input_quote_char
fromgam.cfg
will be used -
endcsv
- Use this option to signal the end of the csvfile parameters in the case that the next argument on the command line isfields
but is specifying the output field list for the command not column headings -
fields <FieldNameList>
- The column headings of a CSV file that does not contain column headings -
(keyfield <FieldName> [keypattern <RegularExpression>] [keyvalue <String>] [delimiter <Character>])+
-
keyfield <FieldName>
- The column containing key values -
[keypattern <RegularExpression>] [keyvalue <String>]
- Allows transforming the value(s) in thekeyfield
column. If onlykeyvalue <String>
is specified, all instances of<FieldName>
inkeyvalue <String>
will be replaced by the item value. Ifkeypattern <RegularExpression>
is specified, the item value is matched against<RegularExpression>
and the matched segments are substituted intokeyvalue <String>
-
delimiter <Character>
- There are multiple values per keyfield column separated by<Character>
; if not specified, there is single value per keyfield column
-
-
(subkeyfield <FieldName> [keypattern <RegularExpression>] [keyvalue <String>] [delimiter <Character>])*
-
subkeyfield <FieldName>
- The column containing subkey values -
[keypattern <RegularExpression>] [keyvalue <String>]
- Allows transforming the value(s) in thesubkeyfield
column. If onlykeyvalue <String>
is specified, all instances of<FieldName>
inkeyvalue <String>
will be replaced by the item value. Ifkeypattern <RegularExpression>
is specified, the item value is matched against<RegularExpression>
and the matched segments are substituted intokeyvalue <String>
-
delimiter <Character>
- There are multiple values per subkeyfield column separated by<Character>
; if not specified, there is single value per subkeyfield column
-
-
(matchfield|skipfield <FieldName> <RegularExpression>)*
- The criteria to select rows from the CSV file; can be used multiple times; if not specified, all rows are selected -
(datafield <FieldName>(:<FieldName)* [delimiter <Character>])*
-
datafield <FieldName>(:<FieldName)*
- The column(s) containing data values -
delimiter <Character>
- There are multiple values per datafield column separated by<Character>
; if not specified, there is single value per datafield column
-
csvdata <FieldName>(:<FieldName>*)
The file Users.csv has a single column of email addresses, there is no header row.
[email protected]
[email protected]
...
gam update group [email protected] sync members file Users.csv
The Google Sheet [email protected] <DriveFileID> <SheetEntity>
has a single column of email addresses, there is no header row.
Define an implicit header with the fields Email
option.
[email protected]
[email protected]
...
gam update group [email protected] sync members csvfile gsheet:Email [email protected] <DriveFileID> <SheetEntity> fields Email
The Google Doc [email protected] <DriveFileID>
has a single column of email addresses, there is no header row.
[email protected]
[email protected]
...
gam update group [email protected] sync members file gdoc [email protected] <DriveFileID>
The CSV file Users.csv has one column of email addresses labelled Email.
Email
[email protected]
[email protected]
...
gam update group [email protected] sync members csvfile Users.csv:Email
The Google Sheet [email protected] <DriveFileID> <SheetEntity>
has one column of email addresses labelled Email.
Email
[email protected]
[email protected]
...
gam update group [email protected] sync members csvfile gsheet:Email [email protected] <DriveFileID> <SheetEntity>
The CSV file Users.csv has two columns of email addresses labelled Email1 and Email2.
Email1,Email2
[email protected],[email protected]
[email protected],[email protected]
...
gam update group [email protected] sync members csvfile Users.csv:Email1:Email2
The Google Sheet [email protected] <DriveFileID> <SheetEntity>
has two columns of email addresses labelled Email1 and Email2.
Email1,Email2
[email protected],[email protected]
[email protected],[email protected]
...
gam update group [email protected] sync members csvfile gsheet:Email1:Email2 [email protected] <DriveFileID> <SheetEntity>
The file Groups.txt has a single column of group email addresses, there is no header row. You want to sync with the members of those groups.
[email protected]
[email protected]
...
gam update group [email protected] sync members datafile groups Groups.txt
The Google Doc [email protected] <DriveFileID>
has a single column of group email addresses, there is no header row.
You want to sync with the members of those groups.
[email protected]
[email protected]
...
gam update group [email protected] sync members datafile groups gdoc [email protected] <DriveFileID>
The CSV file Groups.csv has a single column of group email addresses labelled Group. You want to sync with the members of those groups.
Group
[email protected]
[email protected]
...
gam update group [email protected] sync members csvdatafile groups Groups.csv:Group
The Google Sheet [email protected] <DriveFileID> <SheetEntity>
has a single column of group email addresses labelled Group.
You want to sync with the members of those groups.
Group
[email protected]
[email protected]
...
gam update group [email protected] sync members csvdatafile groups gsheet:Group [email protected] <DriveFileID> <SheetEntity>
The CSV file GroupMembers.csv has headers: group,role,email
Each row contains a group email address, member role (OWNER, MEMBER, MANAGER) and a member email address.
The following command will synchronize the membership for all groups and roles.
gam redirect stdout ./MemberUpdates.txt redirect stderr stdout update group csvkmd GroupMembers.csv keyfield group subkeyfield role datafield email sync csvdata email
The Google Sheet [email protected] <DriveFileID> <SheetEntity>
has headers: group,role,email
Each row contains a group email address, member role (OWNER, MEMBER, MANAGER) and a member email address.
The following command will synchronize the membership for all groups and roles.
gam redirect stdout ./MemberUpdates.txt redirect stderr stdout update group csvkmd gsheet [email protected] <DriveFileID> <SheetEntity> keyfield group subkeyfield role datafield email sync csvdata email
You want to print the membership of a collection of parent groups at your school based on graduation year.
The CSV File Group.csv has exactly the data you want, keypattern
and keyvalue
are not required.
Group
[email protected]
[email protected]
...
For each row, the value from the Group column is used as the group name.
gam csvkmd groups Group.csv keyfield Group print users
The CSV File GradYear.csv has graduation years; you have to convert GradYear to group name [email protected]
, keyvalue
is required.
GradYear
2020
2021
...
For each row, the value from the GradYear column replaces the keyField name in the keyvalue
argument and that value is used as the group name.
gam csvkmd group GradYear.csv keyfield GradYear keyvalue [email protected] print users
The CSV File GradYear.csv has graduation years; you have to convert GradYear to group name [email protected]
, keypattern
and keyvalue
are required.
GradYear
2020
2021
...
For each row, the value from the GradYear column is matched against the keypattern
and the matched segments are substituted into the keyvalue
argument and that value is used as the group name.
gam csvkmd group GradYear.csv keyfield GradYear keypattern '20(..)' keyvalue '\[email protected]' print users
Print users who are specialists or technicians:
gam queries "orgTitle=Specialist,orgTitle=Technician" print users allfields
Print users who are have the title Manager in the sales org or anyone in the marketing org:
gam queries "\"orgName='Sales Org' orgTitle=Manager\",\"orgName='Marketing Org'\"" print users allfields
Print users in either of two Org Units that contain spaces in their names.
gam queries "\"orgUnitPath='/Students/Middle School/2021'\",\"orgUnitPath='/Students/Middle School/2020'\"" print users allfields
This is equivaluent to:
gam ous "'/Students/Middle School/2021','/Students/Middle School/2020'" print users allfields
Need more help? Ask on the GAM Discussion Group
Update History
Installation
- How to Install GAM7
- How to Uograde GAMADV-XTD3 to GAM7
- How to Upgrade Legacy GAM to GAM7
- How to Update GAM7
- Install GAM as Python Library
- GAM7 on Chrome OS Devices
- GAM7 on Android Devices
- Google Network Addresses
- HTTPS Proxy
- SSL Root CA Certificates
- How to Uninstall GAM7
Configuration
- Authorization
- GAM Configuration
- Running GAM7 securely on a Google Compute Engine
- Using GAM7 with a delegated admin service account
- Using GAM7 with a YubiKey
Notes and Information
- Upgrade Benefits
- Questions? Visit the GAM Discussion Forum
- GAM Public Chat Room
- Scripts
- Other Resources
- Drive REST API v3
- BNF Syntax
- GAM Return Codes
- Python Regular Expressions
- Rclone
Definitions
Command Processing
- Bulk Processing
- Command Line Parsing
- Command Logging and Progress
- Command data from Google Docs/Sheets/Storage
- CSV Special Characters
- CSV Input Filtering
- CSV Output Filtering
- Meta Commands and File Redirection
- Permission matches
- Tag Replace
- Todrive
Collections
Client Access
- Addresses
- Administrators
- Alert Center
- Aliases
- Calendars
- Calendars - Access
- Calendars - Events
- Chrome Auto Update Expiration Counts
- Chrome Browser Cloud Management
- Chrome Device Needs Attention Counts
- Chrome Installed Apps
- Chrome Policies
- Chrome Printers
- Chrome Profile Management
- Chrome Version Counts
- Chrome Version History
- ChromeOS Devices
- Classroom - Courses
- Classroom - Guardians
- Classroom - Invitations
- Classroom - Membership
- Cloud Channel
- Cloud Identity Devices
- Cloud Identity Groups
- Cloud Identity Groups - Membership
- Cloud Identity Policies
- Cloud Storage
- Context Aware Access Levels
- Customer
- Domains
- Domains - Verification
- Domain People - Contacts & Profiles
- Domain Shared Contacts - Global Address List
- Email Audit Monitor
- Find File Owner
- Google Data Transfers
- Groups
- Groups - Membership
- Inbound SSO
- Licenses
- Mobile Devices
- Organizational Units
- Reports
- Reseller
- Resources
- Send Email
- Schemas
- Shared Drives
- Sites
- Users
- Unmanaged Accounts
- Users - Signout and Turn off 2-Step Verification
- Vault - Takeout
- Version and Help
Special Service Account Access
Service Account Access
- Users - Analytics Admin
- Users - Application Specific Passwords
- Users - Backup Verification Codes
- Users - Calendars
- Users - Calendars - Access
- Users - Calendars - Events
- Users - Chat
- Users - Classification Labels
- Users - Classroom - Profile
- Users - Deprovision
- Users - Contacts
- Users - Contacts - Delegates
- Users - Drive - File Selection
- Users - Drive - Activity/Settings
- Users - Drive - Cleanup
- Users - Drive - Comments
- Users - Drive - Copy/Move
- Users - Drive - Files-Display
- Users - Drive - Files-Manage
- Users - Drive - Orphans
- Users - Drive - Ownership
- Users - Drive - Permissions
- Users - Drive - Query
- Users - Drive - Revisions
- Users - Drive - Shortcuts
- Users - Drive - Transfer
- Users - Forms
- Users - Gmail - Client Side Encryption
- Users - Gmail - Delegates
- Users - Gmail - Filters
- Users - Gmail - Forwarding
- Users - Gmail - Labels
- Users - Gmail - Messages/Threads
- Users - Gmail - Profile
- Users - Gmail - S/MIME
- Users - Gmail - SendAs/Signature/Vacation
- Users - Gmail - Settings
- Users - Group Membership
- Users - Keep
- Users - Looker Studio
- Users - Meet
- Users - Classroom - Profile
- Users - People - Contacts & Profiles
- Users - Photo
- Users - Profile Sharing
- Users - Shared Drives
- Users - Spreadsheets
- Users - Tasks
- Users - Tokens
- Users - YouTube