CSV file and updating accounts

626 views
Skip to first unread message

Martin Vonášek

unread,
Jul 25, 2016, 4:57:27 AM7/25/16
to Google Apps Manager
Hi,

we started work with GAM and we have some questions:
  1. in our Googl Apps for Education we have many accounts (we created it before we started with GAM) and its very difficult to move for example 30 account to new org or groups. But we have csv file (from our school records) with these account (firstname, lastname) and we would like to use these csv for updating these accounts. So, for example, we create org a1620 and we need to fill these org with accounts which exists in our GAforEdu and we have csv file with first/lastname columns.
  2. where we have to put csv file when we want use it in GAM - in gam folder?
thanks a lot for your responds

Ross Scroggs

unread,
Jul 25, 2016, 9:18:18 PM7/25/16
to google-ap...@googlegroups.com
Martin,

This will take some work if your school records CSV file has only first and last names. Gam needs the user email address.

gam print users name ou > users.csv

Produces a CSV file with these headers:

primaryEmail,name.familyName,name.fullName,name.givenName,orgUnitPath


I'll assume that your school records CVS file school.csv has the headers:

FirstName,LastName,Organization


You're going to produce a new CSV file neworg.csv with these headers:

primaryEmail,orgUnitPath


Write a script that loops over school.csv, find the record in users.csv where name.FamilyName matches LastName and name.GivenName matches FirstName.

Write a record into neworg.csv with the primaryEmail value from users.csv and translate Organization from school.csv into the appropriate value for orgUnitPath.


gam csv neworg.csv gam update user ~primaryEmail ou ~orgUnitPath


Ross


--
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 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/0e7ea270-85da-4625-aad8-920ef4d5df50%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--

Martin Vonášek

unread,
Jul 26, 2016, 3:14:28 PM7/26/16
to Google Apps Manager
Ross,

thank you. I created users.csv (via gam print users name ou > users.csv) and I can´t write script, but I will do it manually - we have only 13 classes with 30 students, I will copy their rows from users.csv by information from school csv in neworg.csv for each class. After it, I will try gam csv neworg.csv gam update user ~primaryEmail ou ~orgUnitPath. 

I have one question more: it is same command for GROUPS (like emailist), so in header of csv I will put column Group and write there appropriate value for each users??

Thanks a lot



Dne úterý 26. července 2016 3:18:18 UTC+2 Ross Scroggs napsal(a):
Martin,

This will take some work if your school records CSV file has only first and last names. Gam needs the user email address.

gam print users name ou > users.csv

Produces a CSV file with these headers:

primaryEmail,name.familyName,name.fullName,name.givenName,orgUnitPath


I'll assume that your school records CVS file school.csv has the headers:

FirstName,LastName,Organization


You're going to produce a new CSV file neworg.csv with these headers:

primaryEmail,orgUnitPath


Write a script that loops over school.csv, find the record in users.csv where name.FamilyName matches LastName and name.GivenName matches FirstName.

Write a record into neworg.csv with the primaryEmail value from users.csv and translate Organization from school.csv into the appropriate value for orgUnitPath.


gam csv neworg.csv gam update user ~primaryEmail ou ~orgUnitPath


Ross

On Mon, Jul 25, 2016 at 1:57 AM, Martin Vonášek <m...@levyuhel.com> wrote:
Hi,

we started work with GAM and we have some questions:
  1. in our Googl Apps for Education we have many accounts (we created it before we started with GAM) and its very difficult to move for example 30 account to new org or groups. But we have csv file (from our school records) with these account (firstname, lastname) and we would like to use these csv for updating these accounts. So, for example, we create org a1620 and we need to fill these org with accounts which exists in our GAforEdu and we have csv file with first/lastname columns.
  2. where we have to put csv file when we want use it in GAM - in gam folder?
thanks a lot for your responds

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



--

Ross Scroggs

unread,
Jul 26, 2016, 3:30:18 PM7/26/16
to google-ap...@googlegroups.com
Martin,

If you are putting each user in one group, this is simple. You'll run a second command to add the user to a group.

You're going to produce a new CSV file neworg.csv with these headers:

primaryEmail,orgUnitPath,Group


Add user to Org Unit:

gam csv neworg.csv gam update user ~primaryEmail ou ~orgUnitPath

(Alternative: gam csv neworg.csv gam update ou ~orgUnitPath add user ~primaryEmail)


Add user to Group:

gam csv neworg.csv gam update group ~Group add member user ~primaryEmail


Ross


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



--

--
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 https://groups.google.com/group/google-apps-manager.

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



--

Martin Vonášek

unread,
Aug 2, 2016, 7:12:06 AM8/2/16
to Google Apps Manager
Ross,

thank you again for help - I used vlookup function instead script and everything work.

Dne úterý 26. července 2016 21:30:18 UTC+2 Ross Scroggs napsal(a):
To unsubscribe from this group and stop receiving emails from it, send an email to google-apps-manager+unsub...@googlegroups.com.



--

--
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-ap...@googlegroups.com.
Visit this group at https://groups.google.com/group/google-apps-manager.



--
Reply all
Reply to author
Forward
0 new messages