AppsScriptPulse

Smart replacing images in Google Slides with Gemini Pro API and Vertex AI

Image credit: Ivan Kutil

Surely, you have also experienced having a presentation in which you needed to replace old content with new. Replacing text is very simple because you just need to use the Replace function, and you can either do it in the Google Slides user interface.

The problem arises when you need to replace one image with another, for example, if your corporate logo is updated to a new graphic design or if one of your favorite cloud services updates its icons (Gmail, blink blink ;-) It’s still somewhat bearable with one presentation, but what do you do when, like me, you have thousands of Google Slides files on your Google Drive?

This post explores a clever application of the Gemini API’s multimodal capabilities, created by Ivan Kutil. His code utilizes GenAI to automatically detect outdated logos within your Google Slides presentations. The original blog post (March 2024) used the Gemini Pro Vision API. As a sign of how rapidly this area evolves, Google now recommends switching to Gemini 1.5 Flash or Gemini 1.5 Pro.

Switching to the newer APIs is very straightforward as all you need to do is search the source code for models/gemini-pro-vision and replace with models/gemini-1.5-flash or models/gemini-1.5-pro.

For Apps Script projects I lean towards Gemini 1.5 Flash as it is designed for speed. I’m also always looking to opportunities to test the GeminiApp library for Apps Script and very quickly I was able to fork Ivan’s code and use Gemini 1.5 Flash using a service account.

While GeminiApp requires some initial setup, it offers significant advantages:

  • Easy Model Testing: Experiment with various models quickly.
  • Built-in Features: Includes functionalities like exponential backoff.

If you would like to explore here is a sample slide deck you can copy which has the container bound forked code (if you don’t want to use a service account here is more information on other setup options).

Source: Smart replacing images in Google Slides with Gemini Pro API and Vertex AI

16 secrets tips, tricks and features for new Google Apps Script Editor (v2020)

Google Apps Script has a new editor, which is better, nicer, and completed ready for future new features. Today, I would like to introduce you to several dirty and secret tricks, what you can do.

If you like a keyboard shortcut you’ll love this post from Ivan Kutil! For those less keen on keyboard commands there is still plenty of other productivity tips from Ivan shared in this post.

Source: 16 secrets tips, tricks and features for new Google Apps Script Editor (v2020)

Machine learning in Google Sheet with Tensorflow.js and Google Apps Script 

This article will show you how you can setup, train, and predict spreadsheet data with deep-learning framework Tensorflow.js. You don’t need to call REST APIs or use other 3rd parties storage and algorithm. All your data stays in your secure Google Sheet.

Source: kutil.org: Machine learning in Google Sheet with Tensorflow.js and Google Apps Script

How to measure latency between Google Apps Script project and Google Cloud Platform regions ~ kutil.org

How to measure latency between Google Apps Script project (with UrlFetchApp) and Google Cloud Platform regions (e.g. if you are choosing region for GCP project)

Source: How to measure latency between Google Apps Script project and Google Cloud Platform regions ~ kutil.org

Deploy Google Apps Script web app as an Android application ~ kutil.org

Step-by-step tutorial how to deploy Google Apps Script to Google Play Store for internal web apps usage

Source: Deploy Google Apps Script web app as an Android application ~ kutil.org