Archive all Google Classes in prep for new school year via GAM

1,916 views
Skip to first unread message

John Risk

unread,
Aug 24, 2021, 2:28:03 PM8/24/21
to GAM for Google Workspace
I've been requested to archive all Google Classrooms from last school. There is over 2k as as of today.

What GAM command would help me accomplish this task? 

Thank you in advance.

John Risk

Jay Lee

unread,
Aug 24, 2021, 2:34:46 PM8/24/21
to google-ap...@googlegroups.com
Get a list of open courses. This should be the list of courses you want to archive. Check it first to make sure there aren't any you want to keep open, remove them as needed:

gam print courses state active,provisioned > open-courses.csv

Now feed the edited, verified and saved file back into GAM for archiving:

gam csv revised-open-courses.csv gam update course ~id state ARCHIVED

Jay Lee


--
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/06cd255a-51d1-4367-b9c7-47583c006350n%40googlegroups.com.

John Risk

unread,
Aug 24, 2021, 3:59:25 PM8/24/21
to google-ap...@googlegroups.com
Thank you so much for that information. I believe I am almost there but I am receiving the following error when trying to process the edited file. Am I not editing the correct field?

image.png

Ross Scroggs

unread,
Aug 24, 2021, 4:04:13 PM8/24/21
to google-ap...@googlegroups.com
John,

Excel ruined the course Ids by converting them to floating point.

You'll have to regenerate your original file if you don't have a copy and use something other than Excel to make your changes.
You can try opening it in Excel, select the id column and format it to be a number with 0 decimal places.
You'll be OK if the course Ids are now just digits but not id they all end in 0000.

Ross



--

John Risk

unread,
Aug 24, 2021, 4:59:39 PM8/24/21
to google-ap...@googlegroups.com
Works like a charm .... Thank you.

But someone had a change of heart. Is there a way to mark all 2k that were archived to active?

Ugh..... 

Seth Dimbert (Hillel Yeshiva)

unread,
Aug 24, 2021, 5:03:10 PM8/24/21
to GAM for Google Workspace
Yes. Just reactivate them using the same spreadsheet you used to deactivate them.

Ross Scroggs

unread,
Aug 24, 2021, 5:15:13 PM8/24/21
to google-ap...@googlegroups.com
As Seth says:
gam csv revised-open-courses.csv gam update course ~id state ACTIVE

Ross





--

John Risk

unread,
Aug 25, 2021, 2:29:09 PM8/25/21
to google-ap...@googlegroups.com
Thank you for the response and I know it was a simple answer to reverse what I did but I got the following outcome.

image.png

Ross Scroggs

unread,
Aug 25, 2021, 2:49:49 PM8/25/21
to google-ap...@googlegroups.com
John,

Once again, Excel has ruined the Course IDs, you've got to get clean data without Excel messing it up.

Contact me directly.

Ross



--

Shane Jacobson

unread,
Jun 6, 2024, 8:49:09 AM6/6/24
to GAM for Google Workspace

First GAM command to get a list of all the open Google Classrooms:

gam print courses state active,provisioned > open-courses.csv

This command above will generate a csv file where you can get all the Google Classroom id's. You may have to open as a text file, delimited format comma and that first id column as text to see the numbers correctly but that is the only data you need out of the file. Or after you download the file, open a new fresh excel doc, do a DATA from TEXT import, select the file from above, then delimited, comma, next, text and finish to get it to show you that first id column and all the id numbers so you can copy and past them into another excel sheet I will explain below.


Now feed the edited, verified and saved file back into GAM for archiving:


Second GAM command that will archive all your Google Classrooms based on all the id's of the classrooms you save in a csv file:

gam csv classroomarchive.csv gam update course ~id state ARCHIVED

This command will archive the classrooms based on the id's you have in a CSV file. I created a .csv file with 1 header called id and I just paste all the ids from the other file into this file so it looks like this


id

53625426352

35156156846

12315648563


This is the tricky part that is actually very easy:

The CSV file won't retain your format when you get it all setup the way you want, in my case 1 header called id and then long numbers below that header. So I would get it the way I needed it, save and close the file, run my command and it wouldn't work, said the data wasn't correct.  To make this work,  get the file all setup the way it needs to be, save the file leaving it open and then run the command GAM command that references that CSV that is open.  It then worked with no issues for me.  So getting the CSV setup the way I wanted, saving it and leaving it open kept it in the format where GAM could read it as well.

 

Reply all
Reply to author
Forward
0 new messages