AppsScriptPulse

Introducing ChatGPTApp, a new library for Google Apps Script and ChatGPT (and a new way to generate personalised mail merges)

Last month, OpenAI announced Function calling, “a new way to more reliably connect GPT’s capabilities with external tools and APIs”. Super useful ❤️ and we decided to integrate that with Google Apps Script.

Following on from yesterday’s Pulse post which highlighted Ben Collins reflections on ‘What can AI do for you as a Google Sheets user? Is the hype justified?’, here is a contribution from another Apps Script expert, Romain Vialard, announcing a ChatGPT library for Google Apps Script.

The source post highlights a number of examples, including the standard ‘prompt’ calling. Where this post gets very interesting is integration with Open AI’s function calling features:

In an API call, you can describe functions to gpt-3.5-turbo-0613 and gpt-4-0613, and have the model intelligently choose to output a JSON object containing arguments to call those functions. The Chat Completions API does not call the function; instead, the model generates JSON that you can use to call the function in your code.

To illustrate this below is a screenshot of a very slightly extended example, which has a Google Sheet with the headings email, name and tip topic. The functions are described to ChatGPT and in the case of sendMessage() the parameters it requires. The ChatGPTApp library handles the functions and in the case of the getContactsList() uses it to pass the Google Sheet data for ChatGPT to format a JSON response to correctly call the sendMessage() function.

I found it took me a while to start understanding what is going on and would recommend experimenting with the library and sample code to get a sense what is possible.

Source: Introducing ChatGPTApp, a new library for Google Apps Script

Process only selected Google Sheets rows in Google Apps Script – The Mergo and Publigo Google Workspace Add-on solution

If you selected 1 or more rows, Publigo lets you generate a personalized document for those rows only or all visible rows in your sheet. Image credit: Romain Vialard

It is super easy in Google Sheets to select only specific rows, even if they are not adjacent. Simply hold down the CTRL / command key while making your selections. And those selections are also available in Google Apps Script via the method getActiveRangeList() … For Google Apps Script developers, here is a quick snippet showing how to process only selected rows.

Following the previous Pulse post on Get all selected Ranges in Google Sheets Romain Vialard got in touch to highlight the approach they have implemented to include this feature in the Mergo and Publigo Google Workspace Add-ons. This source post from Romain includes a snippet of code which might be useful for other Google Apps Script developers.

Source: Process only selected rows in scripts and add-ons

Mergo: Designing a template gallery in a Google Workspace add-on

Mergo is a mail merge add-on for Gmail. With the new gallery, users can easily create, share & reuse templates.

Instead of starting your email from scratch, you can open the gallery and select a template: it will appear as a draft in Gmail.

We recently had Romain Vialard join us on Totally Unscripted to talk about some of his add-ons. This post is another example of Romain’s continual exploration of Apps Script, this time looking the new Grid view for the CardService. You an find out more in the source link.

Source: Mergo: Designing a template gallery in a Google Workspace add-on

Mergo – Mail Merge for Gmail – A free lifetime subscription for Google Workspace for Education users

As teachers gear up for the new school year, we’re glad to offer a free lifetime subscription to your school, college or university. 🥳

I’m sure many of you have come across Romain Vialard who has been contributing to the Google Apps Script community since the product was in beta.

Mergo, Mail Merge for Gmail, is one of the latest products to be developed by Romain and for Google Workspace for Education users the great news is that until the 20 September 2021 there is an offer for a free lifetime subscription! Follow the source link for more details.

Source: Mergo – Mail Merge for Gmail – Back to school

Deploy easily with the new Google Apps Script IDE

A week ago Google announced the availability of an improved code editor for Google Apps Script. … In this article, I’ll focus on the changes related to Versions and Deployments in Apps Script.

Post from Romain Vialard unpicking deployments with the new Apps Script IDE. Romain highlights lots of very useful tips and things to be aware of when deploying Apps Script projects, in particular:

For existing scripts, deploying from the new IDE will create a new deployment with a different url for your web app

Source: Deploy easily with the new Google Apps Script IDE

Retrieve previous versions of Google Apps Script projects

Photo by James Lee on Unsplash

Retrieve the source code linked to a specific version of your Apps Script project then save it as a new Apps Script project – RomainVialard/access-code-of-older-versions

Neat solution from Romain Vialard to retrieve a previous version of your Apps Script code. There is an open feature request to have this as a built-in feature of Apps Script (as noted by Romain recovering a previous script version is also possible using clasp using pull and an optional version number).

Source: RomainVialard/access-code-of-older-versions

Google Slides API — a deep dive on its powerful image manipulation methods

A post dedicated to devs and highlighting the power of the Slides API.

Use Google Apps Script and the Google Slides API to create a card game like Dobble.

Source: Google Slides API — a deep dive on its powerful image manipulation methods

Make your own Dobble / Spot It game with Google Slides and Apps Script

Upload a few images to Google Drive, press a trigger to start a little Apps Script code and get your own Dobble game on Google Slides.

This tutorial will guide you into creating your own Dobble card deck with Google Slides, which you can easily print for use in your day to day life.

Source: Make your own Dobble / Spot It game with Google Slides and Apps Script