Batch Script that will list ALL your Google Classrooms in your G:Suite deployment

In a larger deployment of Google G:Suite for Education my previous script for listing all the classrooms fails – it runs out of time.  I’ve now resolved this using script properties and batching the script so that it saves where it gets to before it times out and then schedules it’s self to run again using a timing trigger.

The amended script will now run over a period of time and will correctly list all the Google Classrooms in your G:Suite deployment. This took about one hour to list the 4727 classrooms in one G:Suite deployment I have access to.

When the script completes it sends an email to your email address – you’ll need to type this email address into the script!

This script will make a Sheet in your Drive with the filename of the current date and  “Class Listing” e.g. 20170516ClassroomListing, which will contain a list of all the Classrooms you have permission to view (superadmins can view all of them).  Don’t run it too close to midnight as the Sheet filename will change after 0:00 😉

You’ll need to use Google AppsScript, add this code and enable the Drive, AdminDirectory, Gmail and Classroom APIs for AppScript (from Resources->Advanced Google services…)

The Function listClasses is the one you want the script to run when you initially call it. After that it will schedule itself until it completes.

Share
%d bloggers like this: