As a Google Apps for Education admin you are probably getting everyone into Google Classroom. In my twenty plus years of using technology, Google Classroom is the most focused and useful tool for learning and teaching I’ve ever used. It does what I want as a teacher: making the digital tools disappear so I can focus on helping my learners. And the feedback from the teachers I work with is hugely positive – something that, in truth, I rarely hear about technology in education.
As a Google Apps for Education admin, it would be really useful to see all the classrooms that have been created in your deployment. This GoogleApps Script does just that. It will made a Sheet in your Drive called “Class Listing” which will contain a list of all the Classrooms you have permission to view (superadmins can we all of them).
You’ll need to use Google AppScript, add this code and enable the Drive, AdminDirectory and Classroom APIs for AppScript (from Resources->Advanced Google services…)
bpugh2
I’m getting these notices:
ReferenceError: “Classroom” is not defined. (line 33, file “”)
What can I do?
Thank you!
Charlie Love
Did you enable the Classroom API? Go to the script, select Resources->Advanced Google Services and enable the Drive and Classroom APIs to On.
bpugh2
Sorry, but sloppy reading. Enabled both, but now getting:
The request was blocked. Quota configuration not found for the requesting project. (line 33, file “”)
Charlie Love
You’ll also need the Admin Directory API. Let me know if that helps?
bpugh2
I have all 3 enabled. Still getting:
The request was blocked. Quota configuration not found for the requesting project. (line 33, file “”)
Charlie Love
Ok, you’ll also have to enable the APIs in the Google Developer Console. So when you go to Advanced Google Services… you’ll see a grey box at the bottom of the service window which says “These services must also be enabled in the Google Developers Console.” Click the link and enable the Admin SDK, Classroom and Drive APIs there too.
ScotEduBlogs
ScotEduBlogs: List all your Google Classrooms using AppScript http://t.co/bIVmzVwKhM
bpugh2
That did it! Wonderful!!!
Possible to add all which students were added to each class?
All of this is so very useful. Thank you!
Jason Kries (@jasonkries)
I’ve added a bit to Charlie’s code to give you the number of students in each course, the enrollment code, and the course ID:
List all Google Classroom Groups With Scripts | Jason Kries on Technology
[…] script (which was adapted from another blog here) will allow you to create a spreadsheet with a full list of classes taught by everyone in your […]
Julia Harris
First, this is AWESOME! I wasn’t sure how many teachers were using Google Classroom, and there’s a lot more than I thought. Great job!
I did have a few questions and some feedback. The function stopped running and gave the error “Exceeded maximum execution time”. I ran it twice, and it stopped at different points. It looks like it’s pulling based on the creation date, so I’m not too worried about stopping right now. However as time goes on, this will cause a problem. For example, we currently have 538 active classes and one of the queries stopped at 739.
Which gets to my next question.. is there a way to change the code to pull only ACTIVE classes and ignore ARCHIVED classes? I have basic knowledge of JavaScript, but not enough to write my own script or make changes like this.
Thanks again for creating this!
ferrarik
I am getting the same error as bpugh2, when I go into the console, I enabled the APIs but it wants me to set credentials??
Matt
Thanks Charlie!
Has anyone found a way around the “Exceeded maximum execution time” issue yet? It looks like there’s a hard limit of 6 minutes imposed by Google (see https://developers.google.com/apps-script/guides/services/quotas#current_limitations) so I suspect this might need to be broken up into smaller chunks for orginizations with more than about 500 google classrooms.
Mitch
Thank you so much for this script! I was wondering if you might be able to help as I want to add the department of the teacher but when I added var loc = ownerObj.organizations[0].department; it only processes 1/3 of the groups before Google Scripts times out. Is there a way to store the organizations array somewhere else to speed things up?
Mike Allen
Keep getting this error when trying to run script. any ideas?
ReferenceError: “ownerObj” is not defined. (line 51, file “Code”)
Serg Karavansky
Charlie Love thank You very much for this script, more 12 month I use script and everything was perfect until yesterday, then running -> Internal error encountered. (line 34, file “List classroom”) (var courses = Classroom.Courses.list(optionalArgs);). Maybe You have some idea ? enabled the Drive, AdminDirectory and Classroom APIs for AppScript (from Resources->Advanced Google services…) and in the Google Developers Console enabled the Admin SDK, Classroom and Drive APIs there too
Tina Bacolas
I am getting: ReferenceError: “ownerObj” is not defined. (line 51, file “Code”)
Help?
Charlie Love
New version at https://charlielove.org/?p=10117 which will also work on large deployments without timing out.
Charlie Love
New version at https://charlielove.org/?p=10117
Charlie Love
New version https://charlielove.org/?p=10117
Charlie Love
New version at https://charlielove.org/?p=10117
Charlie Love
New version which doesn’t time out at https://charlielove.org/?p=10117
Charlie Love
New version at https://charlielove.org/?p=10117
Aftab Ahmad
Amazing thank you! that worked perfectly, at least I’m able to see who I need to contact to carchive off old classrooms.
Alfred
this would be better if you added the number of students inside a classroom (another column telling the total no. of students in a classroom.