Bulk import users into a group with csv file

14,947 views
Skip to first unread message

Jordan

unread,
Nov 1, 2013, 1:38:12 PM11/1/13
to google-ap...@googlegroups.com
Hello,

I was able to import users into a group using a csv file, however for some reason the script runs 3 times every time.  The first run through it successfully adds the members to the group and then immediately it starts the list over again and each one errors as a duplicate. It then starts a third time and they all error again as duplicates.  It's not that big of a deal with just a few members, but my groups can sometimes be thousands of users and that's going to pose a problem.  Here's my script.  If anyone has any ideas I would be grateful!

$list = Import-Csv C:\gam-64\test_group.csv
foreach ($entry in $list)
{.\gam update group te...@mydomain.org add member file test_group.csv}

Thank you!

Jordan

Barry Foley

unread,
Nov 1, 2013, 4:40:49 PM11/1/13
to google-ap...@googlegroups.com
Try this where your cvs file has an attribute heading username 
$list = Import-Csv C:\gam-64\test_group.csv
foreach ($entry in $list)
{.\gam update group te...@mydomain.org add member $($entry.username)}
--
You received this message because you are subscribed to the Google Groups "Google Apps Manager" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-apps-man...@googlegroups.com.
To post to this group, send email to google-ap...@googlegroups.com.
Visit this group at http://groups.google.com/group/google-apps-manager.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-apps-manager/4dce632a-ff4b-41c3-92e9-0284f7c3dc27%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Jordan

unread,
Nov 4, 2013, 8:45:11 AM11/4/13
to google-ap...@googlegroups.com
That worked!! Thank you very much! :)

Steve Samoska

unread,
Mar 2, 2015, 7:49:17 PM3/2/15
to google-ap...@googlegroups.com
Hey Jordan you seem and talk like this is a easy thing but i am a carpet cleaner.. lol.. but anyways that's a compliment to you. I am trying to make 1335 group towns with 3000 members per a group. I used the gam a couple years a go but seem to be having trouble with remembering all the steps and setting up windows powershell cant even find the correct one i need to download. I followed the steps and think i completed them but thats were i stand can you help me out on thi. Thank you so much for your time.

Steve

if you like to not receive this email please reply no thank you and your address will be removed

Creekside Information

unread,
Feb 27, 2017, 6:37:13 AM2/27/17
to GAM for G Suite
Bazzaman:

I am new to using Google tools.  Can you tell me how and where you runa script like this as I constant,y have new members in my organization.

Thanks for your help form a newbee

Kevin


On Friday, November 1, 2013 at 4:40:49 PM UTC-4, Bazzaman wrote:
Try this where your cvs file has an attribute heading username 
$list = Import-Csv C:\gam-64\test_group.csv
foreach ($entry in $list)
{.\gam update group te...@mydomain.org add member $($entry.username)}

On Friday, 1 November 2013, Jordan wrote:
Hello,

I was able to import users into a group using a csv file, however for some reason the script runs 3 times every time.  The first run through it successfully adds the members to the group and then immediately it starts the list over again and each one errors as a duplicate. It then starts a third time and they all error again as duplicates.  It's not that big of a deal with just a few members, but my groups can sometimes be thousands of users and that's going to pose a problem.  Here's my script.  If anyone has any ideas I would be grateful!

$list = Import-Csv C:\gam-64\test_group.csv
foreach ($entry in $list)
{.\gam update group te...@mydomain.org add member file test_group.csv}

Thank you!

Jordan

--
You received this message because you are subscribed to the Google Groups "Google Apps Manager" 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.

Kevin Melillo

unread,
Feb 27, 2017, 8:42:29 AM2/27/17
to google-ap...@googlegroups.com
I believe the GAM command you are running 

gam update group te...@mydomain.org add member file test_group.csv

Does not need the outside loop.  It is using the file test_group.csv for the commands.  Can you please post your test_group.csv file here as well? 

On Mon, Feb 27, 2017 at 6:36 AM, Creekside Information <creeks...@gmail.com> wrote:
Bazzaman:

I am new to using Google tools.  Can you tell me how and where you runa script like this as I constant,y have new members in my organization.

Thanks for your help form a newbee

Kevin

On Friday, November 1, 2013 at 4:40:49 PM UTC-4, Bazzaman wrote:
Try this where your cvs file has an attribute heading username 
$list = Import-Csv C:\gam-64\test_group.csv
foreach ($entry in $list)
{.\gam update group te...@mydomain.org add member $($entry.username)}

On Friday, 1 November 2013, Jordan wrote:
Hello,

I was able to import users into a group using a csv file, however for some reason the script runs 3 times every time.  The first run through it successfully adds the members to the group and then immediately it starts the list over again and each one errors as a duplicate. It then starts a third time and they all error again as duplicates.  It's not that big of a deal with just a few members, but my groups can sometimes be thousands of users and that's going to pose a problem.  Here's my script.  If anyone has any ideas I would be grateful!

$list = Import-Csv C:\gam-64\test_group.csv
foreach ($entry in $list)
{.\gam update group te...@mydomain.org add member file test_group.csv}

Thank you!

Jordan

--
You received this message because you are subscribed to the Google Groups "Google Apps Manager" group.
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.



--
Kevin Melillo
Electronic Communications Analyst
Information Technology
445 Hoes Lane
Piscataway, NJ 08854

Phone:732-465-6609 | Mobile: 732-609-4331

+KimNilsson

unread,
Feb 27, 2017, 10:48:51 AM2/27/17
to GAM for G Suite
You're correct, Kevin.
As long as test_group.csv contains a list of properly formatted usernames, there's no need for a loop.
Hmm, I worded that incorrectly. There's no need for a loop, at all.

The file command reads the csv, and inserts them in the command, and they are each run one by one.

Keith Badler

unread,
Mar 2, 2017, 11:06:02 AM3/2/17
to GAM for G Suite
Did you ever find out what tool you had to use to run the script? I want to add a bulk set of emails into a "group" i setup.

Thanks

+KimNilsson

unread,
Mar 2, 2017, 11:24:54 AM3/2/17
to GAM for G Suite
Hi, Keith.

You just use this tool, GAM.
Install it according to the guide in the wiki.
Then use the command that Kevin gave, on your file with email addresses.

gam update group groupname@yourdomain.org add member file file_with_email_addresses.csv

anas benyamna

unread,
Feb 7, 2018, 9:42:27 PM2/7/18
to GAM for G Suite
i get error with csv 3 ( firstname , lastname , email )
invalid member key
how i can import it with 3 columns please ?

Kim Nilsson

unread,
Feb 8, 2018, 3:01:52 AM2/8/18
to Google Apps Manager
There should be no spaces in the CSV.

firstname,lastname,email

mustapha ait taleb

unread,
May 5, 2018, 2:44:57 PM5/5/18
to GAM for G Suite


On Thursday, February 8, 2018 at 9:01:52 AM UTC+1, +KimNilsson wrote:
There should be no spaces in the CSV.

firstname,lastname,email

 hi ,  do you mean they sould all be in one column ? 
 

Ross Scroggs

unread,
May 5, 2018, 5:39:15 PM5/5/18
to google-ap...@googlegroups.com
It should be firstname,lastname,email no firstname   ,  lastname   , email

--
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 post to this group, send email to google-ap...@googlegroups.com.

fakir dounia

unread,
May 6, 2018, 8:20:03 AM5/6/18
to google-ap...@googlegroups.com
okey thanks , one more thing . as i uploaded those members there was a lot of theme bouncing! is there is a commande to remove all bouncing members from the group ?  Thank you 

On Sat, May 5, 2018 at 11:39 PM, Ross Scroggs <ross.s...@gmail.com> wrote:
It should be firstname,lastname,email no firstname   ,  lastname   , email

On May 5, 2018, at 11:18 AM, mustapha ait taleb <aittale...@gmail.com> wrote:



On Thursday, February 8, 2018 at 9:01:52 AM UTC+1, +KimNilsson wrote:
There should be no spaces in the CSV.

firstname,lastname,email

 hi ,  do you mean they sould all be in one column ? 
 

--
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.

--
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.

Brandon Gordon

unread,
Oct 29, 2019, 1:32:04 PM10/29/19
to GAM for G Suite
Hi, I was wondering if you know a command to upload a csv using gam. This csv file is formatted to be uploaded through google admin but I would like for gam to do it. This way I could create a batch file to automate the uploads. Currently this file is downloaded from our Student Information System every night so it is constantly updating. All I need GAM to do is upload this file from a location on my server or computer. This would allow me to not have to create the student emails once in our SIS and again in Google Admin.

Ross Scroggs

unread,
Oct 29, 2019, 1:37:14 PM10/29/19
to google-ap...@googlegroups.com
Brandon,

What are your CSV file headers?

Ross

CONFIDENTIALITY DISCLAIMER 

This email (including attachments) is confidential information protected by the Electronic Communications Privacy Act 18 U.S.C. §2510-2521 and any other applicable law, and may not be opened or forwarded without consent of the named recipient(s). It is intended only for the use of the individual or entity named herein. If the reader of this message is not the intended recipient, or the employee or agent responsible to deliver it to the intended recipient, you are hereby notified that any retention, dissemination, distribution or copying of this communication is strictly prohibited. If you have received this communication in error, please immediately notify us by return email. Thank you. 

--
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/e5416a1b-e91a-4ca1-9ba1-67282cc4e65f%40googlegroups.com.


--

Brandon Gordon

unread,
Oct 29, 2019, 2:09:07 PM10/29/19
to google-ap...@googlegroups.com
That was fast. Thanks for replying. They are the following:

Password [Required], Last Name [Required], First Name [Required], Org Unit Path [Required], Email Address [Required], Department Home, Phone Number




--
Brandon Gordon
Technology Coordinator
Amite County School District


James SEYMOUR

unread,
Oct 29, 2019, 7:55:30 PM10/29/19
to GAM for G Suite
Hi Brandon,

This might give you something to work with. I think this should work for adding the user (Email), but test it first. I think the ~'Email Address' is correct, but I normally use ~Email so don't normally deal with spaces in the field names. If you need to add other details from the CSV, then you will need to add to the end of this command. I think, but sure someone will correct me if there is a better (correct) way :)

gam csv file_with_email_addresses.csv gam update group groupname@yourdomain.org add member user ~'Email Address'

I have a collection of commands here https://sites.google.com/jis.edu.bn/gam-commands/ which you may find useful.

Regards

James

On Wednesday, 30 October 2019 02:09:07 UTC+8, Brandon Gordon wrote:
That was fast. Thanks for replying. They are the following:

Password [Required], Last Name [Required], First Name [Required], Org Unit Path [Required], Email Address [Required], Department Home, Phone Number


On Tue, Oct 29, 2019 at 12:37 PM Ross Scroggs <ross....@gmail.com> wrote:
Brandon,

What are your CSV file headers?

Ross

On Tue, Oct 29, 2019 at 10:32 AM Brandon Gordon <bgo...@amite.k12.ms.us> wrote:
Hi, I was wondering if you know a command to upload a csv using gam. This csv file is formatted to be uploaded through google admin but I would like for gam to do it. This way I could create a batch file to automate the uploads. Currently this file is downloaded from our Student Information System every night so it is constantly updating. All I need GAM to do is upload this file from a location on my server or computer. This would allow me to not have to create the student emails once in our SIS and again in Google Admin.

On Thursday, March 2, 2017 at 10:24:54 AM UTC-6, +KimNilsson wrote:
Hi, Keith.

You just use this tool, GAM.
Install it according to the guide in the wiki.
Then use the command that Kevin gave, on your file with email addresses.

gam update group groupname@yourdomain.org add member file file_with_email_addresses.csv


CONFIDENTIALITY DISCLAIMER 

This email (including attachments) is confidential information protected by the Electronic Communications Privacy Act 18 U.S.C. §2510-2521 and any other applicable law, and may not be opened or forwarded without consent of the named recipient(s). It is intended only for the use of the individual or entity named herein. If the reader of this message is not the intended recipient, or the employee or agent responsible to deliver it to the intended recipient, you are hereby notified that any retention, dissemination, distribution or copying of this communication is strictly prohibited. If you have received this communication in error, please immediately notify us by return email. Thank you. 

--
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.


--
Ross Scroggs

--
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.
Reply all
Reply to author
Forward
0 new messages