Learn to Code With Google Sheets Macros

Last week, G Suite made an update to Sheets that made their product a little more efficient: macros. Perhaps you’ve noticed them in Microsoft Excel, and now they’re available in G Suite.

What IS a macro, anyway? It’s a way to automate tasks you have to do repeatedly, without writing code. To use them, go to Tools>Macros, record yourself completing the series of tasks you want to automate, save and name the recording, and then you can use it over and over again. If you’re not into coding, this can be a game-changer to save you some time later on repetitive tasks. Macros can be recorded so that they are performed over the exact area recorded on (think cells B2 through B7), or on a relative location (the active selection), so think about how you plan to use the macro before you start recording. (If Macros aren’t showing up in your Tools menu yet, check back in a few days. The nice people at Google told me that it could take up to 15 days from their new features roll out on 4/11/18 for everyone to have access to the shiny new features.)

But I AM a (novice) coder, and I’m excited about what this can do to expand my knowledge base. You see, G Suite Macros automatically transform the macro into code in Google Apps Scripts. Once you save the macro, click “Edit Script” to see what your actions look like in Google Apps Scripts code, which is a variation of JavaScript. You can access the script later by choosing “Manage Macros” and clicking the three dots to show the “Edit Script” option.

So, if there’s a task I know how do to manually, but haven’t the faintest idea how to code, theoretically, I can work backwards! I can create a macro for the task, and look at the code the macro created, instead of writing the code, hoping it will do what I want, and banging my head against the desk when it doesn’t for the 934th time. Once the script is created, I can analyze it to learn to write the code for the task I know how to do manually. Since I’ll know the end result of the code, I can use it to learn the commands and formatting that  created the desired result.

Typically, I put lines of code that I’ve found tricky to remember, but I know I’m likely to use again as notes into Google Keep. I make all of my coding notes the same color and give them the label “Code” to easily find what I’m looking for when I need it.

 

Advertisements

Using AutoCrat in the Classroom

At a training I attended a couple of months ago, I was shown how to use the add-on autoCrat for Google Sheets. It takes information from a Google Sheet and disseminates it into specified places on a Google Doc based on a template that includes <<merge tags>>. Once in the Doc, it can be emailed automatically to specific email addresses as a Doc or PDF, shared with specific people, or just kept in your Google Drive.

The possibilities are endless for how to use this, but here are a few ideas. Feel free to check out my AutoCrat Ideas folder in Google Drive. All of the files there are set up for you to have viewing access, but File>Make a copy will add a copy of it to your drive to edit for your own use.

  • At Meet the Teacher night, instead of trying to read information scrawled on the papers you left around the room, have parents completed a Google Form. From there, use an autocrat job to: send a personalized welcome email, and populate a student information sheet that you can print for your sub folder and teacher planner.
  • Alice Keeler had the brilliant idea to use AutoCrat to create personalized newsletters for each student. I have a sample in my folder. My sample was made very lazily, so there are options such as, “Student is doing social studies,” but it’s enough to give you the idea of how it works. For the newsletter, I have mine set up to not run the AutoCrat job until I manually go to the spreadsheet and push the run button. That way, no one gets their newsletter until I’m ready to send it to everyone. I made a Google Form for it, but some sections will be the same for every student (although, not for every newsletter), such as general information and important dates. I plan on completing that part of the form for the first student, then copying and pasting for the rest of the class in the spreadsheet. Another alternative would be to update the template before running the AutoCrat job for each edition of the newsletter, and just eliminating that question from the Form.
  • Filling out award certificates.
  • Sending emails to parents to inform them about an event regarding their child (positive message, missing work, etc.)
  • Sharing the questions and a student’s answers to a Google Forms quiz with their family in a neat document.
  • Awarding badges or certificates for completing specific tasks.

Do you already use autoCrat in your classroom? What are some other ideas you have for how to use it to make your life easier?