using CSV to update username, first name, last name

518 views
Skip to first unread message

Jason Miller

unread,
Aug 30, 2017, 5:04:45 PM8/30/17
to GAM for G Suite
I can't seem to figure out where I'm going wrong. I have a CSV file setup with: 

email,firstname,lastname,username

And I want to update the users in this file with new first/last names and a new username. 

Every variation of csv command I run doesn't work and returns an error. Usually it's 'Failed to execute script gam' 

Can someone tell me the correct command I should be using to update all those fields at once?

many, many thanks - Jason

Ross Scroggs

unread,
Aug 30, 2017, 5:23:32 PM8/30/17
to google-ap...@googlegroups.com
Jason,

What do you mean by username? John Doe or jd...@domain.com

If it's John Doe, Google makes that for you; Google refers to this as fullName and you can't change it.

gam csv filename.csv gam update user ~email firstname ~firstname lastname ~lastname

If it's a new email address, then:

gam csv filename.csv gam update user ~email firstname ~firstname lastname ~lastname email ~username

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/05330b86-546b-430d-a0bf-9d4090b7297f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--

Jason Miller

unread,
Aug 30, 2017, 11:11:26 PM8/30/17
to google-ap...@googlegroups.com
Here's the setup:

User currently has email address:
First name: Afr
Last name: Ayy

I want to edit this and 49 other users the same way by changing their info to:

Email address:
First name: April
Last name: Friedman

First column in csv has header 'email' with afr...@myschool.org below

Second column has header 'firstname' with April below

Third column has header 'lastname' with Friedman below

Fourth column has header 'username' with FriedmanA below

I tried running that exact command you cited first, except adding ~username username at the end. Didn't work.
Also tried running it with just one or two of the variables, didn't work.

What am you doing wrong?

Jason

On Wed, Aug 30, 2017 at 5:23 PM Ross Scroggs <ross.s...@gmail.com> wrote:
Jason,

What do you mean by username? John Doe or jd...@domain.com

If it's John Doe, Google makes that for you; Google refers to this as fullName and you can't change it.

gam csv filename.csv gam update user ~email firstname ~firstname lastname ~lastname

If it's a new email address, then:

gam csv filename.csv gam update user ~email firstname ~firstname lastname ~lastname email ~username

Ross


On Wed, Aug 30, 2017 at 2:04 PM, Jason Miller <jmi...@elisabethmorrow.org> wrote:
I can't seem to figure out where I'm going wrong. I have a CSV file setup with: 

email,firstname,lastname,username

And I want to update the users in this file with new first/last names and a new username. 

Every variation of csv command I run doesn't work and returns an error. Usually it's 'Failed to execute script gam' 

Can someone tell me the correct command I should be using to update all those fields at once?

many, many thanks - Jason

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



--

--
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/AFsHCa-Oj3Y/unsubscribe.
To unsubscribe from this group and all its topics, send an email to google-apps-man...@googlegroups.com.
To post to this group, send email to google-ap...@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.
--
Jason Miller
Technical Support
Elisabeth Morrow School

Ross Scroggs

unread,
Aug 31, 2017, 7:46:13 AM8/31/17
to google-ap...@googlegroups.com
Jason,

I need details as to what "didn't work" means; please post error message.

Ross

Jason Miller

unread,
Aug 31, 2017, 7:49:17 AM8/31/17
to google-ap...@googlegroups.com

techs-iMac:gam tech$ gam csv 5thnamechange.csv gam update user ~Email firstname ~first

Traceback (most recent call last):

  File "gam.py", line 12144, in <module>

  File "gam.py", line 11403, in ProcessGAMCommand

  File "gam.py", line 334, in next

  File "gam.py", line 334, in <genexpr>

UnicodeDecodeError: 'utf8' codec can't decode byte 0x96 in position 2: invalid start byte

Failed to execute script gam

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 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/AFsHCa-Oj3Y/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.
--
Jason Miller
Technical Support
Elisabeth Morrow School

--
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 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/AFsHCa-Oj3Y/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.

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

Ross Scroggs

unread,
Aug 31, 2017, 8:17:35 AM8/31/17
to google-ap...@googlegroups.com
Jason,

The problem is that you have non UTF data in the file, typically accented characters. 
It's hard to get Excel on the Mac to save UTF, so you have to tell gam that the data is in another character set.

gam csv 5thnamechange.csv charset latin1 gam update user ~Email firstname ~first username ~username



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.
Message has been deleted

Jay Lee

unread,
Jul 16, 2021, 2:53:27 PM7/16/21
to google-ap...@googlegroups.com
I have to ask...why? Seems like it'd just make usernames and your Inbox all the harder to read and parse...

Jay Lee


On Fri, Jul 16, 2021 at 2:51 PM Andrew Oberste <aobe...@slpsb.org> wrote:
I know this isn't a time machine and this was 4 years ago, but what was the solution here?  I need to update my entire Google Workspace to Education FirstName and LastName on each user to be all caps, can someone help me what command and csv columns format was the exact solution to this issue?  

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



--

--
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/AFsHCa-Oj3Y/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-ap...@googlegroups.com.
Visit this group at https://groups.google.com/group/google-apps-manager.
--
Jason Miller
Technical Support
Elisabeth Morrow School

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


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



--
Jason Miller
Technical Support
Elisabeth Morrow School

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

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

--
You received this message because you are subscribed to the Google Groups "GAM for Google Workspace" group.

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

Jay Lee

unread,
Jul 16, 2021, 2:59:29 PM7/16/21
to google-ap...@googlegroups.com
Ignoring my opinion though, the how shouldn't be that hard depending on the OS you are using (you didn't say) but on Linux / Bash you can use the tr command:

gam print users name | tr a-z A-Z | gam csv - gam update user ~PRIMARYEMAIL firstname NAME.GIVENNAME lastname NAME.FAMILYNAME

Jay Lee

Reply all
Reply to author
Forward
0 new messages