Export / Import Contact

528 views
Skip to first unread message

Gustavo H.

unread,
Sep 20, 2023, 9:22:12 AM9/20/23
to GAM for Google Workspace
Hi guys,
Is there a way with gam that I can export contacts from UserB and import to UserA?
I could not find in the documentation.

thank you.

//Gustavo

Ivan Boskovic

unread,
Sep 20, 2023, 10:12:04 AM9/20/23
to GAM for Google Workspace
Hi Gustavo,

You can do it. It's a 2 step process.
First, you have to export contacts from UserA into a CSV file, then use that CSV file to import them to UserB.

For export you would use GAM command:   gam redirect ./file.csv gam user us...@domain.com print contacts

From that you can filter out which columns you want to import for the new contacts, rename or note down the headers for the columns to import and create the new contacts from them for UserB.
It would look something like this depending on what information you want to bring over:   gam csv ./file.csv gam user us...@domain.com create contact email ~email givenName ~firstname familyName ~ lastname
etc.

Ross Scroggs

unread,
Sep 20, 2023, 10:30:52 AM9/20/23
to google-ap...@googlegroups.com
Gustavo,

If you want to copy all of the contacts with no change you can do the following:
# Get contacts  and othercontacts from user A
gam redirect ./file.csv gam user us...@domain.com print contacts format json
Add selectmaincontacts to the command if you do not want user A's other contacts

# Add contacts to user B
gam csv ./file.csv gam user us...@domain.com create contact json "~JSON"

Ross
----
Ross Scroggs



--
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.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-apps-manager/9b01107f-0a52-49bd-8980-c4a0b05dd38en%40googlegroups.com.

Ivan Boskovic

unread,
Sep 20, 2023, 10:54:46 AM9/20/23
to GAM for Google Workspace
Just a small correction there Ross,

It'll have to be "formatjson" together in the first command.
This is brilliant Ross!
I didn't know this can ber done in this way. Makes things much easier.
Thanks!

Gustavo H.

unread,
Sep 20, 2023, 12:13:15 PM9/20/23
to GAM for Google Workspace
thank you guys. How to "formatjson" ?
 What should be the correct command?

Ross Scroggs

unread,
Sep 20, 2023, 12:18:20 PM9/20/23
to google-ap...@googlegroups.com
If you want to copy all of the contacts with no change you can do the following:
# Get main contacts only from user A

gam redirect ./file.csv gam user us...@domain.com print contacts formatjson selectmaincontacts

# Get main contacts  and othercontacts from user A; this would not be typical
gam redirect ./file.csv gam user us...@domain.com print contacts formatjson

# Add contacts to user B
gam csv ./file.csv gam user us...@domain.com create contact json "~JSON"

----
Ross Scroggs


Gustavo H.

unread,
Sep 20, 2023, 12:28:09 PM9/20/23
to GAM for Google Workspace

great !!!
About Calendar, because that datatransfer is not working, can I use the same export logic to transfer calendar data from UserB to UserA?

Gustavo H.

unread,
Sep 20, 2023, 12:28:19 PM9/20/23
to GAM for Google Workspace
PS: You guys rock !!!!

Ross Scroggs

unread,
Sep 20, 2023, 2:58:55 PM9/20/23
to google-ap...@googlegroups.com
--
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.

Gustavo H.

unread,
Sep 21, 2023, 10:22:09 AM9/21/23
to GAM for Google Workspace
Thank you Ross,
How do we move all the calendar events from UserA to UserB ? I could not see that in the documentation.
thank you again for your patience.
//Gustavo

Gustavo H.

unread,
Sep 21, 2023, 10:29:24 AM9/21/23
to GAM for Google Workspace
Is this logic correct?
gam calendar $CalendarSourceID move events to $CalendarDestinationID

Ross Scroggs

unread,
Sep 21, 2023, 10:41:42 AM9/21/23
to google-ap...@googlegroups.com
gam calendar $CalendarSourceID move events before now to $CalendarDestinationID
----
Ross Scroggs



Ross Scroggs

unread,
Sep 21, 2023, 11:49:40 AM9/21/23
to google-ap...@googlegroups.com
Gustavo,

This suggestion is incorrect: gam calendar $CalendarSourceID move events before now to $CalendarDestinationID

Your command is correct.

Ross
----
Ross Scroggs



Gustavo H.

unread,
Sep 23, 2023, 10:01:49 AM9/23/23
to GAM for Google Workspace
Thank you Ross.
I'm running it now, and I have this feedback: 

Move Failed: Writer access required to both calendars 

When I installed GAM/Advanced, I checked all the checkboxes.

Can you assist?

//Gustavo


Ross Scroggs

unread,
Sep 23, 2023, 4:03:51 PM9/23/23
to google-ap...@googlegroups.com
See: https://github.com/taers232c/GAMADV-XTD3/wiki/Users-Calendars-Events#move-calendar-events-to-another-calendar

gam user us...@domain.com move events primary to us...@domain.com

usera has to have write access to the primary calendar of user b

gam us...@domain.com add calendaracls primary writer us...@domain.com

Ross
----
Ross Scroggs



Gustavo H.

unread,
Sep 27, 2023, 10:53:13 AM9/27/23
to GAM for Google Workspace
Hi Ross,
Sorry, I was traveling.
That didn't work.

gam $secondaryaccount add calendaracls primary writer $primaryaccount 

I tried this: gam user $secondaryaccount add calendaracls writer $primaryaccount

, but that just changed (I guess) the main calendar, not the other calendars that the users created.

Do you have suggestions?


Reply all
Reply to author
Forward
0 new messages