AppsScriptPulse

Google Maps Formulas for Google Sheets – Digital Inspiration

You can bring the power of Google Maps to your Google Sheets using simple formulas with no coding. You don’t need to sign-up for the Google Maps API and all results from Google Maps are cached in the sheet so you are unlikely to hit any quota limits.

Great post from Amit Agarwal using the Maps Service for Google Sheets custom functions.

Use Google Maps formulas inside Google Sheets to calculate distances, travel time, get driving directions, look up postal codes with reverse geocoding and more!

The post includes all the source code and has some great examples using the V8 syntax.

Source: Google Maps Formulas for Google Sheets – Digital Inspiration

Google Apps Script: Automated PDF Certificate Creator That Is Emailed to the Attendee – Yagisanatode

Use Google Apps Script, Google Slides and Google Sheets to quickly automate creating a Certificate of Attendance and send it to attendees.

Nice example using Google Apps Script to generate and share .pdf documents via email. The source has all the code you need to get going on this.

Source: Google Apps Script: Automated PDF Certificated Creator That Is Emailed to the Attendee – Yagisanatode

Retrieving Data from QR code on Google Slides using Google Apps Script · tanaike

This is a sample script for decoding a QR code put in Google Slides using Google Apps Script. In this case, Javascript is used at the opened dialog. And Canvas API and jsQR are used.

This is a nice example of how you can easily drop in existing JavaScript libraries into your Apps Script project by using a HTML dialog. The post also has some nice tricks for handing image data, in particular, from getDataFromQRCode() the image data is passed into the HtmlService:

const html = HtmlService.createTemplateFromFile("index");
html.image = JSON.stringify(blob.getBytes()); // adding image data
SlidesApp.getUi().showModalDialog(html.evaluate(), "sample");

This is added in client side with a printing scriptlet:

image.src = `data:image/png;base64,${btoa(String.fromCharCode(...new Uint8Array(Int8Array.of(...JSON.parse(<?= image ?>)).buffer)))}`; 

Another way you could achieve this is base64 encoding the image server side with Utilities.base64Encode().

Source: Retrieving Data from QR code on Google Slides using Google Apps Script · tanaike

Cropping Images in Google Slides using Google Apps Script

This is a sample script for cropping images in the Google Slides using Google Apps Script.

Useful snippet from Tanaike which shows how you can crop images in Google Slides by using the replace(blobSource, crop) method. The  post also highlights a limitation with the image manipulation methods available around crop centering.

Source: Cropping Images in Google Slides using Google Apps Script · tanaike

QUnit2GS is a Google Apps Script Library that allows Apps Script projects to be tested using QUnit

QUnit2GS is a Google Apps Script Library that allows Apps Script projects to be tested using the QUnit JavaScript testing framework – qunitjs.com. Just add this library to your project and start writing tests in just a few minutes.

Created by Andrew Roberts and Alejo Grigera Sutro this library will make it easier to adopt test-driven development with your Google Apps Script projects. The site is worth an explore to see what is possible…

Source: Home | QUnitGS2

Build A Lookup Table Generator For Google Tag Manager with Google Sheets and Apps Script

The purpose of the Lookup Table generator is to automate the often tedious task of adding many, many rows to a Lookup Table within the Google Tag Manager UI. There are other solutions for this, but none (as far as I know) that uses the Google Tag Manager API.

Within the Google Apps Script community there is a strong representation from those working in analytics and SEO. Simo Ahava has shared a comprehensive tutorial which shows how you can interact with the Google Tag Manager API in Google Sheets. Click through to the source for more details and all the code you need.

Source: Build A Lookup Table Generator For Google Tag Manager | Simo Ahava’s blog

Sync RingCentral Call Log into Google Sheets with Google Apps Script | by Embbnux Ji | RingCentral Developers | Medium

In this article, I would like to show you to how to create a Google Sheets add-on to help people sync RingCentral call log into spreadsheets.

Nice post highlighting how you can integrate the RingCentral service into a Sheets Add-on. The post includes more general information about setting up access to the RingCentral API which might be useful in your other projects.

Source: Sync RingCentral Call Log into Google Sheets with Google Apps Script | by Embbnux Ji | RingCentral Developers | Medium

Goa v8 changes and enhancements for OAuth2 and Google Apps Script

Goa tutorial

v8 and other htmlservice changes meant I had to make a few small changes to cGoa. The good news it’s easier to use than ever, and supports a few new services too. It’s best to look at the service list on github, as that’ll be kept up to date. Here’s a reminder of how to use it.

There are a couple of OAuth 2 Google Apps Script libraries out there but cGoa from Bruce Mcpherson is the easiest one I used, particularly, when it comes to setup. Bruce’s post has more details including various ways you can use the library.

Source: Goa v8 changes and enhancements

Google Apps Script: Extract Specific Data From a PDF and insert it into a Google Sheet – Yagisanatode

Have you ever asked for a list from a client, another department or agency and instead of saving into a file that might even be considered marginally useful, they give it to you as a pdf.

After some prostrations to the great Google Apps Script gods, I had a though. “Hey, can’t we convert a PDF to a Google Doc with just a click of the button? Surely the great Google Apps Script devs have made it so we can do it programmatically too.” And you know what? They bloody well did. The big legends.

Yagi shares a comprehensive walk-through of how you can sometimes extract data from .PDF documents using Google Apps Script and the advance Drive service. The solution is also able to work on .PDFs created from images using the built-in OCR features of Google Drive and you might want to drop the getTextFromPDF() function shared in the post.

Source: Google Apps Script: Extract Specific Data From a PDF and insert it into a Google Sheet – Yagisanatode

Calculating moving averages in Google Sheets with Google Apps Script (and tips on writing custom functions)

Por esa razón me he puesto manos a la obra y he preparado MEDIAMOVIL(), una función personalizada GAS capaz de calcular varios tipos de medias móviles, que puede ser utilizada (como todas las funciones personalizadas) de manera combinada con el resto de funciones integradas que nos ofrecen las hojas de cálculo de Google.

TRANSLATED: For this reason I have gotten to work and have prepared MEDIAMOVIL(), a custom GAS function capable of calculating various types of moving averages, which can be used (like all custom functions) in combination with the rest of the integrated functions. offered by Google spreadsheets.

Great post from Pablo Felip (@pfelipm) on calculating moving averages in Google Sheets. As part of this Pablo has developed and shared the MEDIAMOVIL() custom function he has developed in Google Apps Script. Clicking through to the source code on Github Pablo has also shared lots of advice on developing custom functions for Google Sheets including using the contextual help features available in custom functions as well as handling parameters and throwing appropriate error messages to the user.

Source: Calculando medias mĂłviles con Google Apps Script