AppsScriptPulse

Paginating API Calls in Google Apps Script

The featured image is by Brandi Redd on Unsplash

One of my favorite things about Google Apps Script is that I can get information from an API and write it directly to a shared document or spreadsheet…It’s not uncommon for these requests to come back in paginated form. Meaning, if your request has 100 responses, they’ll come in batches of n size instead of all at once.

Pagination can be tricky. This post has a video and sample script to help you abstract the process of working with paginated API responses in Apps Script.

Source: Paginating API Calls in Google Apps Script

Add a Google Meet to Calendar Events with Google Apps Script

My small team relies on automation to make things run. Part of our PD process is a Google Form workflow that kicks off calendar events, document creation, and email notifications. Since we’ve moved to online learning, we wanted to update that process to automatically add a Google Meet link for any PD that doesn’t have to be in person.

There are some official Google guides that show how to attach a Meet event to the Calendar, but nothing from the perspective of Apps Script specifically, so that’s what is shown here.

Source: Add a Google Meet to Calendar Events with Google Apps Script

Unit Testing in GAS Part 5: Testing Objects and Arrays

It’s time to dive into deeper equality situations with objects and arrays. Every test we’ve written so far has used a non-strict comparison. In other words, we’ve only been checking value but not type. This is particularly important in JavaScript because of how it handles truthy and falsy values.

The fifth part of a series using the GAS QUnit library to write unit tests for Apps Script projects in the web editor. This post details testing arrays and objects.

Source: Unit Testing in GAS Part 5: Testing Objects and Arrays

Unit Testing in GAS Part 4: Error Handling | ohhey[blog]

Up until now, our Calcs class has handled errors with simple true and false flags. That’s not helpful to the user. At this point, we’re ready to begin defining and testing custom errors in our functions.

QUnit allows a throws method which can check for errors in your application. This tutorial post adds some error checking to a simple Apps Script project.

Source: Unit Testing in GAS Part 4: Error Handling | ohhey[blog]

Unit Testing GAS Part 3: Adding and Testing Functions | ohhey[blog]

We’ve looked at how to install and configure QUnit and just finished writing some simple tests. In this post, we’re going to write a new method, add(a, b) in Calcs which will add the two passed parameters.

Part 3 in the unit testing series, this post looks at writing tests for new methods and some considerations for when (or when not) to use private functions in Javascript when it comes to testing.

Source: Unit Testing GAS Part 3: Adding and Testing Functions | ohhey[blog]

Unit Testing GAS Part 2: Simple Tests | ohhey[blog]

Unit tests are for single units of code. They test a specific function for a specific result…

Part two in a series on unit testing, this configures the QUnit web application and has you write simple tests against an Apps Script class.

Source: Unit Testing GAS Part 2: Simple Tests | ohhey[blog]

Unit Testing GAS Part 1: QUnit Setup | ohhey[blog]

I’m not good at writing testable code. I’m more of a ‘figure it out when it breaks’ kind of hobby programmer. The problem with this is that I am constantly making my own bugs and not really finding them until a bad time.Unit testing is the process of running automated tests against your code…

The first post in a series, this will eventually be an in-depth look at unit testing both as a habit of writing code and through the lens of large Apps Script projects.

Source: Unit Testing GAS Part 1: QUnit Setup | ohhey[blog]