Inner GeekTechnologies for LearningWeb Design

Google Classroom Assignments to Calendar

Services such as “Show MyHomework” provide a calendar of homework allocated to pupils and classes by their teachers.  These simple tools allow files to be attached to homework but require the files to be download to be completed and printed in a traditional manner.  These tools do not integrate the allocation of assignments/tasks with the tools to carry out the work and depend on the learner having access to the required software to complete the task (and perhaps a printer to transfer it to paper for the teacher!).

It would be great if you could integrate the calendar of assignments with the tools to complete the task AND provide a publicly viewable calendar that parents could view to see the work allocated to their child’s classes in a service that would handle all of the complexity of sharing permissions, copying files etc. for you.

Recently, I’ve been working with Google Apps for Education and particularly Google Classroom.   I’ve received numerous requests for a public calendar of homework so I set about creating just that!  I started reviewing the work at Mr Caffery’s Blog which was a good start but actually contained a number of bugs and I have revised and improved his work.  This article is intended for Google Apps for Education Administrators but feel free to give it a go 🙂 .

Setting up Gmail, Apps Script and Calendar

  1. Create a user in your Google Apps Domain for the public calendar.  You need one user for each publicly viewable calendar.  If your domain covers a number of schools then create a user for each school (myschool1@mydomain.org, myschool2@mydomain.org etc.).
  2. This user needs to be added to every classroom that will be included in the calendar. Teacher’s can invite the user and then the user has to accept the invitation or the user can just join the class in the normal way with the class Joining Code.Go to https://classroom.google.com and signup, using this user calendar user account, to your class / classes using the class code(s) or go to https://mail.google.com and accept the invitations to the classes.
  3. When assignments are set, an email is sent to each user in the classroom.  Our user account is going to filter these emails when they arrive and label them with a new label of “Classroom”.Go to https://mail.google.com.  Sign in using your Calendar User Account.
    Click the settings cog (in the top left of the screen normally)  and choose settings.
    Click Filters and then Create new filter. The Filter pop-up will appear.

    When a email is received from Google Classroom it starts with the text “New Assignment…” in the subject line. Type New Assignment* into the Subject box – the * is a wildcard which means that anything can appear after the text New Assignment.

    Then click Continue.On the next page of the popup, tick the box “Apply the label” then click in the pull down menu and then click New label. A new popup will appear.  Under “Please enter a new label name:” enter Classroom then click Create.Screen Shot 2015-07-08 at 4.06.52 PMFinally, click Create filter.

    Any new email sent which starts with “New Assignment” in the subject line will be labelled with “Classroom”.  This is how we’ll pick out the Google Classroom emails from the others.
    Screen Shot 2015-07-08 at 4.07.49 PM

  4. Now to add the Google Apps Script.Still logged in as your Classroom Calendar user, go to https://drive.google.com and open up your Google Drive.In Google Drive, click New and then more > and then Google Apps Script.If you haven’t used Apps Script before you’ll have to add it using ” + Connect more apps”.

    If you are adding it, just enter Apps Script in the search box of the popup that appears when you click “+ Connect more apps” and it should be the top result.  Just click the + Connect to add it. Once added it will appear in the New menu as described above.

    Screen-Shot-2015-07-08-at-4.12.20-PM
    Connecting Google Apps Script to your Google Drive

     

    Screen-Shot-2015-07-08-at-4.22.58-PM
    Adding the Apps Script application to your Google Drive

    Start your Apps Script project with a new Blank Project (just double click Blank Project to start).  Click the Untitled project text in the top left and call it ClassroomToCalendar (just something to remember what it is!).  Then replace any code in the Code.gs window with the following:

    NOTE: There is a US version of this code on GitHub https://github.com/charlielove/GoogleClassroomToCalendar/tree/US-patch-1
     

    Remember to click Save (in the file menu or the disc icon!).

    Click the triangular play button next to the image of a bug. The script will run and will request access to your drive, mail and calendar. Allow this or it will not work.

  5. You’ll want the script to run every hour to add new assignments to the calendar.  To do this we use the Resources menu. Click Resources and then All your triggers.  Click Add a new trigger and enter the following details.Screen Shot 2015-07-08 at 4.48.31 PMAnd then click Save.
  6. Making the calendar public.  Finally you’ll need to go to http://calendar.google.com and choose the menu from your calendar user’s default calendar.Screen Shot 2015-07-08 at 4.52.32 PMClick calendar settings and then give the calendar a suitable name (something like “All School Homework”) and click Save.

    Now go back into the same calendar settings and click Share this Calendar.  Click the tick box for Make this calendar public and select the option See all event details.  Click Save to store this setting.

    Finally, you’ll want to embed the calendar or share it via a link.  Go back into the same calendar settings as before and there will be some code to Embed This Calendar in a web page and details of the Calendar Address – use the HTML one get a link to share with parents/carers (you could use a shortlink creator like http://bit.ly to generate a short version of this link).

The final calendar embedded looks like:
Screen Shot 2015-07-08 at 5.03.14 PM

Screen Shot 2015-07-08 at 5.03.33 PMIt adds the name of the class followed by the activity to the Calendar entry and includes the name of the main class teacher in the Description. Job done 🙂

The beauty of this solution is that you only need the calendar user to be added to each classroom. Other than this initial setup there is no further complex technical stuff to do!

This code is available on Github at https://github.com/charlielove/GoogleClassroomToCalendar

54 comments
  1. Charlie Love

    Thanks for your work on this. It really helped me get started (and there is a lot of your code in here!!) I’ll be posting updates on the Github. Already found that the default event is a Video Meeting so need to change that for notifications.

  2. Charlie Love

    Hi David,
    Check your Filter rules are tagging assignment emails as Classroom. It will only work for new assignments (unless you manually tag older emails). Also, check you have enabled the permissions for the Apps Script to access Gmail/Drive etc. It uses the default calendar for the user rather than an additional calendar hence why it needs a specific user account to be created. You can use Apps Script debugging to check what is happening.

    Hope that helps.

    Charlie

  3. Jeremy Mitchell-Koch

    This is a great help! I have followed the steps, but have run into an issue. The assignment is placed into the spreadsheet, but it never shows up on the calendar? In the App Script there are 3 functions to choose from (left of the bug)…is this why there is a problem? Thanks for any help or suggestions.

    –Jeremy

  4. Charlie Love

    Hi Jeremy,

    The assignments are added as whole day events to the calendar. It is the the ClassroomToCalendar function that you should run in the AppsScript debug. The Script removes the tag on the emails when it finishes AND changes the items in the spreadsheet so that they won’t be added a second time to the calendar. If you want to re-run the script for testing you need to reflag the classroom emails in Gmail, delete the Spreadsheet called “Classroom Assignments” in drive and check the calendar (best done in Agenda view) and remove any events the script added. You can then rerun the script. I’ve just tested the code again and it is working as given. I hope this helps you.

    Charlie

  5. Bob Schmidt

    Having the same issue as Jeremy. Everything seems to work except nothing shows up on the calendar. I debugged the script and noticed that everything was being posted a year later than it should. All my assignments were in the calendar exactly a year later than they should have been.

  6. Bob Schmidt

    update to my last comment. On our system, the day and month values in stringStartDate are in a different order. The day is first in the array, and the month is second. I had to switch the following:

    var calDay = calSplit[1];
    var calMonth = calSplit[0].substring(0,3);

    Also, calDay also sometimes had a “<" in it for single digit dates. The calDayVal was still evaluated correctly so I had to change deadline to use "String(calDayVal)" instead of calDay.

    Now it seems to work.

  7. Charlie Love

    Great news Bob, I guess this a difference between the UK date displayed in Classroom and the US date. Thanks for your fix! I’ll have a look and see if I can amend the script to detect the format and process it accordingly.

  8. bpugh2

    I keep getting this error message whenever I run the script (ClassroomtoCalendar):

    “This operation can only be applied to at most 100 threads.(line 101,file””) Dismiss.

    Have I done something wrong?

  9. Charlie Love

    Hmmm, check how many emails are tagged with “Classroom” in Gmail – that could be the source of the error. Manually untag them and then retag in batches to put in your calendar. The script is designed to check the notifications every hour – there is a limit on the number of messages that AppScript can process in this manner which you may be hitting.

  10. Charlie Love

    Also check which version of the script you are using. There is a UK/EU one and a US one. The date format in the US notification emails is different from the UK/EU one. I don’t know which format is used in the Canadian version.

  11. bpugh2

    I have only 3 emails tagged as classroom. Also, the time for the script is (GMT-5:00) Eastern Time. (We’re on EDT in Toronto.

    Thank you, Brian.

  12. bpugh2

    Except for the one generated this morning, they were all dated July 12. Would that date make any difference?

    Thank you, Charlie. I really appreciated your help!

    Brian.

  13. Charlie Love

    Can you test this for me. In the script please change the line (around 99)

    var threads = GmailApp.getInboxThreads();

    to this one

    var threads = GmailApp.search(‘label:Classroom’);

    and let me know if that works.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.