AppsScriptPulse

Creating your on preview ink Smart Chips in Google Docs: The Untold Potential of Apps Script

 

Alright, folks, we’re talking about something quite hot off the press in the realm of Google Apps Script — “Smart Chips.” This feature is available within Google Docs and can build previews of pasted links using the Card Service. Think of it as a little preview window of what lies beyond the link — a sneak peek, if you will. 🕵️‍♂️

Editor: Smart chips are a recent feature in Google Workspace that help you quickly insert information into your Docs and Sheets. They can be used to insert people, places, dates, and more. It’s also possible for Google Workspace developers to publish their on ‘Preview links’ smart chips as Workspace Add-ons. In this post from Dmitry Kostyuk you can learn about publishing your own smart chips and some creative ways to get the data you need using Google Apps Script.

Source: Previewing Links with Smart Chips: The Untold Potential of Apps Script

Retrieving and putting values for PDF forms with Google Apps Script (and other PDF solutions)

This is a sample script for retrieving and putting values for PDF Forms using Google Apps Script.

We’ve featured a couple of posts from Kanshi Tanaike on Pulse with solutions for handling/manipulating PDF Documents with Google Apps Script. This post on retrieving values from PDF Documents is just one in a series of recent contributions from Kanshi looking at how Google Apps Script can be used with PDFs:

All these examples use the PDF-LIB JavaScript library and as previously noted in the Pulse post Merging multiple PDF files as a single PDF and converting all the pages in a PDF to PNG images using Google Apps Script , with minor modification to can load this library into the Apps Script editor.

Source: Retrieving and Putting Values for PDF Forms using Google Apps Script

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

What can AI do for you as a Google Sheets user? Is the hype justified?

Image credit: Dall-E/ Ben Collins

See how AI tools work with Google Sheets to boost your productivity. Covers ChatGPT, Google Bard, and AI add-ons.

A very informative post from Ben Collins, discussing how AI can be used to automate tasks, identify patterns, and make predictions in the context of Google Sheets. Ben provides several examples of how Generative AI can be used to improve the way you can interact with data in spreadsheets from helping with formula to generating and improving data.

As Ben points out in the post users have benefited from AI in Google Sheets for a number of years with features like Explore. Perhaps the biggest recent change is exposing Large Language Models as a service, with users able to directly access the ‘prompt’ to generate output.

Source: AI + Google Sheets: How To Use Them Together

Extend the capabilities of PaLM API with Google Apps Script

 

Discover the magic of combining Palm API’s extraordinary capabilities with the limitless potential of Google Apps Script. In this blog we will be taking a look at how we use the PaLM API and Google Apps Script. We will be passing basic prompts and getting the appropriate responses using Google Apps Script.

Yesterday’s Pulse contribution from Aryan Irani there was an overview on getting started with Google’s Gen AI PaLM 2 Large Language Model accessed using MakerSuite. In a follow-up post Aryan continues dives deeper into how the PaLM API can be called from Google Apps Script. The post includes instructions and sample code to help you get started. Aryan will be continuing exploring and sharing what can be done with the PaLM API and Google Workspace tools such as Google Sheets, Google Docs and more in future tutorials.

Source: Extend the capabilities of PaLM API with Google Apps Script

Getting started with Google’s Gen AI (PaLM 2) in Google Apps Script

At the Google I/O ’23, various announcements were made with respect to different AI and ML advancements Google is making as we speak. While listening to the session, I stumbled on PaLM 2. It was really interesting as to what capabilities it has with respect to generative models and machine learning.

This tutorial series will introduce you to PaLM 2, the API, MakerSuite, and Google Apps Script. We will combine these tools to do something interesting with prompts.

Editor: There are a couple of ways you can access Google’s Gen AI language models. Bard is the consumer version but for developers you might want to start exploring API access to one of the underlying foundation language model, PaLM 2, using Google’s MakerSuite. There is a waitlist for MakerSuite, but worth putting your name down if you are interested in an easy way to programmatically start prototyping applications with the PaLM using a basic API key. This video series from Aryan Irani covers everything you need to get started, particularly if you are interested in using PaLM with Google Apps Script.

If you prefer to get started straight away, you can also access the PaLM API in Vertex AI today from a Google Cloud project (more information about this on the MakerSuite site).

Source: Getting started with PaLM 2

Bulk create Drive folders with subfolders with Google Apps Script

Bulk create Google Drive folders with multiple subfolders. Control the naming of the folders and how many you want.

Use this tool to bulk create folders with subfolders

Use this tool to bulk create folders with subfolders

The following Google Apps Script is designed to bulk create Google Drive folders with multiple subfolders. You control the naming convention of each folder and exactly how many you want.

Features include:

  1. Runtime control – currently set to 5 minutes 30 seconds. Will ignore rows that have a ‘Folder Link’ so you can continue from where you left off and append further folders should you require.
  2. More subfolders – the Google Sheet has columns for 10 subfolders but you can technically add more (columns) and the code will account for this automatically.
  3. Toast popups to inform you of the progress as folders are created.
  4. ‘Log’ sheet and popup error messages if something goes wrong.
  5. Concatenation – create those useful descriptive folder/file names so items are easier to search for in the future. Concatenate will let you combine values that may exist in different columns in another spreadsheet for example, or take those folder names and prepend/append words around them.

Source: The Gift of Script: Bulk create Drive folders with subfolders

AppSheet x Slack — Sending notifications on your Slack Channel using Google Apps Script

Make your team acknowledged when there is a new eventEven though a data scientist can do coding, it doesn’t mean that we have to code all the time. In some use case, I found out that no-code development tools benefits us as it reduces time to develop applications for collecting data or small systems for uncomplex internal uses. I have developed several AppSheet applications which help us automate works, make tasks paperless and trackable by records.

We’ve featured a couple of examples of integrating with Slack using Apps Script. Here’s a variation using AppSheet to do some of the heavy lifting with the data automation. To push data to Slack the solution uses AppSheet’s Apps Script integration. I’ve not tested but I’m sure you could skip the Apps Script integration and use AppSheets webhooks feature.

Source: AppSheet x Slack — Sending Notifications on Your Slack Channel

Adding users to Google Chat spaces on demand with Google Apps Script

Image credit: Pablo Felip

A Chat space membership authorization workflow built using Google Forms, Sheets and Apps Script. … In the coming sections, we’ll build a workflow for process managers to review and authorize membership requests sent by users willing to join a predefined set of chat spaces.

Lots of talk about Meta’s new Threads … is there an API for that. Meanwhile Pablo Felip has been busy putting together this very comprehensive tutorial which explains how you can use Google Forms as part of a process to administer Google Chat Spaces membership.

The API call spaces.members.create is relatively straightforward when compared to the amount of effort to setup the Google Cloud project. This is all covered in the source post and the code provided can easily be modified to suit other worksflows.

Source: Adding users to Google Chat spaces on demand with Apps Script

How to transcribe audio and video files from Google Drive with Google Apps Script

Learn how to automatically transcribe audio and video files in Gmail messages with the help of OpenAI speech recognition API and Google Apps Script

Amit Agarwal highlights a no-code solution for transcribing audio in Gmail attachments available in his ‘Save Gmail to Google Drive’ Google Sheets Add-on. As part of this he shares the code and tips for transcribing audio files using OpenAI’s Whisper API. When you look at the snippet provided you’ll see once the audio file is in Google Drive it is very easy to use the Whisper API to get a transcript.

Text-to-speech services aren’t new, but approaches and larger training datasets are improving accuracy and if you prefer to work in the Google ecosystem you can find out more about Cloud Speech-to-Text.

Source: How to Transcribe Audio and Video Attachments in Gmail – Digital Inspiration