Create a book tracker using Apps Script and the Google Books API in 10 minutes

I wanted a quick and easy way for my kids to track the books they read, as well as a way for my wife to catalog all the books we have in our home library. 35 years ago, my dad set up a way for me to do this on our Apple IIe, but because we gave that machine away, I decided to use Google Apps Script.

Create a book tracker using Apps Script and the Google Books API in 10 minutes
Photo by Ed Robertson / Unsplash

I wanted a quick and easy way for my kids to track the books they read, as well as a way for my wife to catalog all the books we have in our home library. 35 years ago, my dad set up a way for me to do this on our Apple IIe, but because we gave that machine away, I decided to use Google Apps Script.

The Components

You can put this together in a few different ways, but here's how I built it in about 15 mins:

The Form

First, create a simple Google Form that collects the ISBN number, and saves its contents to a Google Sheet. For the kids' form, I also had them put in a rating, and a summary of the book in their own words.

The Google Sheet & Apps Script

Inside the Google Sheet, click Tools -> Script Editor

Inside the Google Sheet, click Tools -> Script Editor

Copy paste the code from this repository:

appscript-book-tracker/Code.gs at main · usaussie/appscript-book-tracker
Apps Script to handle looking up Books via ISBN using the Google API, then storing details in a google sheet. - appscript-book-tracker/Code.gs at main · usaussie/appscript-book-tracker

Change the values at the top of the file to reflect how you have your sheet set up.

Save the script and set a trigger to run on Form Submit:

Click Triggers (on the left menu of Apps Script), then click New Trigger and set it up as pictured:

Configuration of trigger

Note, you can also set this trigger up to run on a schedule if your sheet isn't populated by a Google Form.

As written, then script will lookup the Google Book API and retrieve the full Book object, but will only save the title, authors, and description to the sheet. The code should be easy enough to understand how to add new columns to store additional data that comes back from the API.

Data Studio

Once you have the sheet set up, you can connect a data studio dashboard to it. Just go to datastudio.google.com and create a new report (adding the sheet as your data source). You can then display a breakdown of books by any of the dimensions (columns) in your sheet.

For me, our shows the breakdown by which child read the book, what they rated it, and when they read it.

That's it. There's not much to it.

I know there are other services out there like Goodreads that can store your book list...but I just wanted to house the data myself, and not have to create accounts for my young kids.

Link to repo: https://github.com/usaussie/appscript-book-tracker/blob/main/Code.gs