tanaike - Google Apps Script, Gemini API, and Developer Tips

The Thinker

Integrating Gemini and Google Apps Script for Automated Google Slides Presentations

Gists

Abstract

Learn how Gemini AI and Google Apps Script automate Google Slides generation. A developed application demonstrates this synergy, streamlining initial presentation drafting and showcasing AI’s automation potential within Google Workspace.

Introduction

The field of AI, particularly large language models like Google’s Gemini, is advancing rapidly. A powerful application of this technology involves integrating Gemini with Google Apps Script. Google Apps Script provides a seamless way to automate tasks across Google Workspace by natively handling authorization and interaction with services like Google Docs, Google Sheets, and Google Slides. By combining Gemini’s generative capabilities with Apps Script, sophisticated automations become accessible.

Stowage Planning Automation Using Gemini: A Feasibility Study and A Prompt-Based Approach

Gists

Abstract

Gemini 2.5 Pro Experimental enabled automated cargo ship stowage planning via prompt engineering, overcoming prior model limitations. This eliminates the need for complex algorithms, demonstrating AI’s potential in logistics.

Introduction

Recently, I encountered a practical business challenge: automating stowage planning through AI. Specifically, I received a request to generate optimal container loading plans for cargo ships, a task traditionally requiring significant manual effort and domain expertise. In initial tests, prior to the release of Gemini 2.5, I found that existing models struggled to effectively handle the complexities of this problem, including constraints like weight distribution, container dimensions, and destination sequencing. However, with the release of Gemini 2.5, I observed a significant improvement in the model’s capabilities. Utilizing the Gemini 2.5 Pro Experimental model, I successfully demonstrated the generation of viable stowage plans using only carefully crafted prompts. This breakthrough eliminates the need for complex, custom-built algorithms or extensive training datasets. The successful implementation involved providing the model with key parameters such as container dimensions, weights, destination ports, and ship capacity. This report details the methodology, prompt engineering, and results of my attempt to create automated stowage planning using Gemini 2.5 Pro Experimental, highlighting its potential to revolutionize logistics and shipping operations.

Roadmap Generator as Gemini

Gists

Abstract

Gemini and Google Apps Script automate project roadmap creation in Google Sheets, including Gantt charts, improving efficiency and agile planning.

Introduction

When initiating a new project, a comprehensive roadmap is crucial for successful execution. Previously, I meticulously crafted these roadmaps manually, a time-consuming process. However, leveraging the advanced capabilities of Google’s Gemini, I’ve significantly streamlined this workflow. Gemini now assists in generating detailed project roadmaps, enhancing efficiency and accuracy. To further automate this process, I developed a Google Apps Script that dynamically constructs these roadmaps directly within Google Sheets, complete with integrated Gantt charts. This script facilitates the rapid generation of diverse project roadmaps, enabling agile planning and adaptation for future endeavors. This report details the functionality and implementation of this script, demonstrating its potential to optimize project planning and visualization.

Enhanced Text Manipulation in Google Slides using Google Apps Script

Gists

Description

This is a sample Google Apps Script designed to replace all instances of specific text within a Google Slides presentation, while simultaneously applying a desired text style. The built-in Presentation.replaceAllText() method within the Google Slides service is limited; it efficiently replaces text strings but lacks the functionality to modify text formatting during the replacement process. This limitation poses a challenge when aiming for styled text replacements. This report presents a detailed script solution that overcomes this constraint. The script iterates through all text elements within the slides, identifies matching text, and performs a replacement. Crucially, it also applies specified text formatting attributes, such as font, font size, color, and bold/italic settings, to the replaced text. This enhanced functionality allows users to maintain consistent and visually appealing presentations when automating text modifications. Furthermore, the script illustrates the use of TextRange methods for precise text manipulation and styling within Google Slides. This approach offers a more robust alternative to the standard replaceAllText() method, providing greater control over text replacement and formatting in Google Slides automation workflows.

Slide Puzzle in Google Sheets

Gists

Abstract

This report demonstrates the onSelectionChange simple trigger in Google Sheets by creating a slide puzzle. Selecting cells triggers script execution, enabling interactive gameplay.

Introduction

At Google Sheets, simple triggers can be used. When simple triggers are used, users can automatically run Google Apps Script based on actions in the spreadsheet. Among the simple triggers is onSelectionChange. This can automatically run a script when a cell is selected. In this report, as a simple sample script demonstrating the use of onSelectionChange, I created a slide puzzle in Google Sheets. The goal of the slide puzzle is to align the numbers by sliding them. Here, onSelectionChange is used to detect the selected number and slide it. The aim of this report is to learn about the simple trigger onSelectionChange.

Generate Growing Images using Gemini API

Gists

Abstract

Gemini API now generates images via Flash Experimental and Imagen 3. This report introduces image evolution within conversations using Gemini API with Google Apps Script.

Introduction

Recently, image generation was supported in the Gemini API using Gemini 2.0 Flash Experimental and Imagen 3. I have already reported a simple sample script for generating images using the Gemini API with Google Apps Script. Ref In practice, you might want to evolve the generated images within a conversation. In this report, I would like to introduce a sample script demonstrating this using Google Apps Script.

Create Visualized Recipe Instructions with Gemini using Google Apps Script

Gists

Abstract

This report presents a Google Apps Script for generating visualized cooking recipes with text and images using the Gemini API, leveraging its image generation capabilities.

Introduction

Recently, image generation was supported in the Gemini API using Gemini 2.0 Flash Experimental and Imagen 3. I have already reported a simple sample script for generating images using the Gemini API with Google Apps Script. Ref Google Apps Script seamlessly integrates with Google Docs, Sheets, and Slides. In this report, I would like to introduce a script for creating a recipe for cooking a dish, including texts and images, using the Gemini API with Google Apps Script.

Generate Images with Gemini API using Google Apps Script

Gists

Description

Recently, image generation was supported in the Gemini API using Gemini 2.0 Flash Experimental and Imagen 3. This report introduces simple sample scripts for generating images using the Gemini API with Google Apps Script. When images can be created using the Gemini API with Google Apps Script, Google Apps Script, which seamlessly integrates with Google Docs, Sheets, and Slides, becomes a powerful tool for creating and managing them, and the applications are infinite.