Gam Group Sync using a CSV file

2,361 views
Skip to first unread message

Bryan Guidroz

unread,
Aug 29, 2017, 10:40:37 AM8/29/17
to GAM for G Suite
I have some CSV files in this format that I'd like to use to create groups.

Email,FirstName,LastName
johndoe,John,Doe
janedoe,Jane,Doe

And found this example:
gam update group <GroupItem> sync [owner|manager|member] [notsuspended] <UserTypeEntity>

And valid UserTypeEntity are:
(all users)|
(user <UserItem>)|
(users <UserList>)|
(group <GroupItem)|
(ou|org <OrgUnitPath)|
(ou_and_children|ou_and_child <OrgUnitPath>)|
(courseparticipants <CourseID>)|
(students <CourseID>)|
(teachers <CourseID>)|
(file <FileName>)|
(csvfile <FileName>:<FieldName>)| <--- This is what I'm trying to use
(license|licenses|licence|licences <SKUIDList>)|
(query <QueryUser>)

So, I thought this would work:

gam update group te...@mydomain.com sync member notsuspended csvfile team1.csv:Email

But, that isn't correct.
What am I getting wrong?
I end up with a member in the group called csv...@mydomain.com

Ross Scroggs

unread,
Aug 29, 2017, 10:56:38 AM8/29/17
to google-ap...@googlegroups.com
Bryan,

Coding problem, try: gam update group te...@mydomain.com sync member notsuspended csv team1.csv:Email

Ross

--
You received this message because you are subscribed to the Google Groups "GAM for G Suite" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-apps-manager+unsub...@googlegroups.com.
To post to this group, send email to google-apps-manager@googlegroups.com.
Visit this group at https://groups.google.com/group/google-apps-manager.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-apps-manager/fd60d074-eff9-4a18-8b4c-09cae4fcc113%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--

Bryan Guidroz

unread,
Aug 29, 2017, 11:13:17 AM8/29/17
to GAM for G Suite
Thanks.  That did it.
The syntax in GamCommands.txt say "csvfile" instead of just "csv"
That's what got me.
To post to this group, send email to google-ap...@googlegroups.com.



--

Ross Scroggs

unread,
Aug 29, 2017, 11:25:51 AM8/29/17
to google-ap...@googlegroups.com
Bryan,

csvfile is included to resolve an ambiguity.
This command does multiprocessing, no field name is allowed: gam csv filename gam ...
This command does not, it just reads the CSV file using the field name and processes it: gam csvfile filename:fieldname ...

At other places in the command line, csv filename:fieldname is allowed which could be confusing.
Thus the documentation keeps the two forms separate.
Unfortunately, csvfile was left out of a list of valid entries for <UserTypeEntity>.

Ross


To unsubscribe from this group and stop receiving emails from it, send an email to google-apps-manager+unsubscribe...@googlegroups.com.



--

--
You received this message because you are subscribed to the Google Groups "GAM for G Suite" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-apps-manager+unsub...@googlegroups.com.
To post to this group, send email to google-apps-manager@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.



--

Jeff Puls

unread,
Mar 9, 2018, 4:31:27 AM3/9/18
to GAM for G Suite
Is it possible then to use a csv like the one below to insert row-level data into other places in the gam update group sync command? For example

gam update group ~group sync ~role csv UsersAndGroups.csv:email

(this obviously doesn't work...)

Ross Scroggs

unread,
Mar 9, 2018, 10:53:49 AM3/9/18
to google-ap...@googlegroups.com
Jeff,

You can't get what you want with standard GAM without preprocessing UsersAndGroups.csv.
With the latest version, 4.55.39, of my Advanced GAM (https://github.com/taers232c/GAMADV-X) or Advanced GAM with Team Drives (https://github.com/taers232c/GAMADV-XTD) you can do what you want directly with GAM.
(This specific from of the group sync command was in previous versions but had a serious bug, only perform this command with 4.55.39 and higher.)

You would issue a gam command for each role type that you want to update.
gam update group csvkmd UsersAndGroups.csv keyfield group matchfield role owner datafield email sync owner csvdata email
gam update group csvkmd UsersAndGroups.csv keyfield group matchfield role manager datafield email sync manager csvdata email
gam update group csvkmd UsersAndGroups.csv keyfield group matchfield role member datafield email sync member csvdata email

Here's the basic syntax and a breakdown of one of the commands.

gam update group <GroupEntity> sync [owner|manager|member] <UserTypeEntity>


gam update group - We're updating groups

<GroupEntity> - Define fields: csvkmd UsersAndGroups.csv keyfield group matchfield role member datafield email

sync member - We're syncing members

<UserTypeEntity> - Reference previously defined field: csvdata email


UsersAndGroups.csv can have rows in any order.



--
You received this message because you are subscribed to the Google Groups "GAM for G Suite" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-apps-manager+unsub...@googlegroups.com.
To post to this group, send email to google-apps-manager@googlegroups.com.
Visit this group at https://groups.google.com/group/google-apps-manager.

Jeff Puls

unread,
Mar 9, 2018, 2:09:56 PM3/9/18
to google-ap...@googlegroups.com
Ross,

Understood and thank you . You, sir, are appreciated.

To unsubscribe from this group and stop receiving emails from it, send an email to google-apps-manager+unsubscribe...@googlegroups.com.

--
You received this message because you are subscribed to a topic in the Google Groups "GAM for G Suite" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/google-apps-manager/opDt1BU9Mkc/unsubscribe.
To unsubscribe from this group and all its topics, send an email to google-apps-manager+unsub...@googlegroups.com.

To post to this group, send email to google-apps-manager@googlegroups.com.
Visit this group at https://groups.google.com/group/google-apps-manager.

For more options, visit https://groups.google.com/d/optout.



--
Jeff Puls, CETL
Chief Technology Officer
School District of Clayton
#2 Mark Twain Circle, Clayton, MO 63105
Twitter: @ClaytonEdTech

Steven Coombs

unread,
May 11, 2020, 12:48:49 PM5/11/20
to GAM for G Suite
Why might I get this error do you think with this command?

C:\GAM>gam update group csvkmd groupupdate.csv keyfield group matchfield role member datafield email sync member csvdata email

ERROR: groupupdate.csv is not a valid argument for "gam update group"

C:\GAM>




On Friday, March 9, 2018 at 3:53:49 PM UTC, Ross Scroggs wrote:
Jeff,

You can't get what you want with standard GAM without preprocessing UsersAndGroups.csv.
With the latest version, 4.55.39, of my Advanced GAM (https://github.com/taers232c/GAMADV-X) or Advanced GAM with Team Drives (https://github.com/taers232c/GAMADV-XTD) you can do what you want directly with GAM.
(This specific from of the group sync command was in previous versions but had a serious bug, only perform this command with 4.55.39 and higher.)

You would issue a gam command for each role type that you want to update.
gam update group csvkmd UsersAndGroups.csv keyfield group matchfield role owner datafield email sync owner csvdata email
gam update group csvkmd UsersAndGroups.csv keyfield group matchfield role manager datafield email sync manager csvdata email
gam update group csvkmd UsersAndGroups.csv keyfield group matchfield role member datafield email sync member csvdata email

Here's the basic syntax and a breakdown of one of the commands.

gam update group <GroupEntity> sync [owner|manager|member] <UserTypeEntity>


gam update group - We're updating groups

<GroupEntity> - Define fields: csvkmd UsersAndGroups.csv keyfield group matchfield role member datafield email

sync member - We're syncing members

<UserTypeEntity> - Reference previously defined field: csvdata email


UsersAndGroups.csv can have rows in any order.


To post to this group, send email to google-ap...@googlegroups.com.

Ross Scroggs

unread,
May 11, 2020, 12:57:48 PM5/11/20
to google-ap...@googlegroups.com
Steven,

That is an Advanced GAM (https://github.com/taers232c/GAMADV-XTD3) command; it is not available ti standard GAM.


In accordance with The Companies (Registrar, Languages and Trading Disclosures) Regulations 2006: * Registered name: The American School in London Educational Trust Limited * Registered number: 784923 * Place of registration: England * Registered office address: One Waverley Place, London, NW8 0NP



In accordance with The Companies (Registrar, Languages and Trading Disclosures) Regulations 2006: * Registered name: The American School in London Educational Trust Limited * Registered number: 784923 * Place of registration: England * Registered office address: One Waverley Place, London, NW8 0NP


--
You received this message because you are subscribed to the Google Groups "GAM for G Suite" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-apps-man...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-apps-manager/420afc2b-ed78-4f4f-947d-ceb75adbe070%40googlegroups.com.

David Lee

unread,
Aug 11, 2020, 11:19:24 AM8/11/20
to GAM for G Suite
upgrade to the latest version - I had the same issue last week - fixed it a treat.
Reply all
Reply to author
Forward
0 new messages