Consolidate Scattered A1Notations into Continuous Ranges on Google Spreadsheet using Google Apps Script

Gists

Consolidate Scattered A1Notations into Continuous Ranges on Google Spreadsheet using Google Apps Script

Abstract

Consolidate scattered cell references (A1Notation) in Google Sheets for efficiency. This script helps select cells by background color or update values/formats, overcoming limitations of large range lists.

Introduction

When working with Google Spreadsheets, there might be a scenario where you need to process scattered A1Notations (cell addresses in the format “A1”). This could involve selecting cells with specific background colors, updating cell values, or modifying cell formats.

Specifying Output Types for Gemini API with Google Apps Script

Gists

Specifying Output Types for Gemini API with Google Apps Script

Abstract

The Gemini API generates different outputs depending on the prompts. This report explains how to use function calling in the new Gemini 1.5 API to control the output format (string, number, etc.) within a script during a chat session. This allows for more flexibility in using the Gemini API’s results.

Introduction

The appearance of Gemini has already brought a wave of innovation to various fields. When the Gemini API returns a response, the format of the response is highly dependent on the input text provided as a prompt. For instance, to retrieve the output value as a JSON object, you need to explicitly include a prompt like “Return JSON” within your input. However, there can be situations where the API doesn’t return the data in the desired format.

Identifying Colored Cell Regions in Google Sheets with Google Apps Script

Gists

Identifying Colored Cell Regions in Google Sheets with Google Apps Script

Overview

This Google Apps Script helps identify and analyze regions of colored cells in a Google Sheet.

Description

Recently, I encountered a situation where I needed to identify colored cell regions in Google Sheets. For instance, consider the following spreadsheet:

Identifying Colored Cell Regions in Google Sheets with Google Apps Script

The region enclosed by the red cells (B2:D4) is a rectangle. In this case, the closed region can be easily identified using a simple script in Google Sheets. However, the region enclosed by the blue cells (H3, I2, J2,,,) is more complex. It consists of multiple disconnected cells that form a single shape. Identifying such irregular shapes using a script can be challenging.

Parsing Invoices using Gemini 1.5 API with Google Apps Script

Gists

Parsing Invoices using Gemini 1.5 API with Google Apps Script

Abstract

This report explores using Gemini, a new AI model, to parse invoices in Gmail attachments. Traditional text searching proved unreliable due to invoice format variations. Gemini’s capabilities can potentially overcome this inconsistency and improve invoice data extraction.

Introduction

After Gemini, a large language model from Google AI, has been released, it has the potential to be used for modifying various situations, including information extraction from documents. In my specific case, I work with invoices in PDF format. Until now, I relied on the direct search by a Google Apps Script to achieve this task. The script’s process involved:

Convert Soft Breaks to Hard Breaks on Google Documents using Google Apps Script

Gists

Description

This script converts soft breaks to hard breaks in a Google Document using Google Apps Script.

Usage

Follow these steps:

1. Create a New Google Document

Create a new Google Document and open it. Go to “View” -> “Show non-printing characters” in the top menu to see line breaks in the document body (as shown in the image below).

2. Sample Script

Copy and paste the following script into the script editor of your Google Document.

Technique for Appending Values to Specific Columns on Google Spreadsheet using Google Apps Script

Gists

Technique for Appending Values to Specific Columns on Google Spreadsheet using Google Apps Script

Abstract

This report addresses the challenge of appending values to specific columns in Google Sheets when columns have uneven last rows. It offers a Google Apps Script solution with a sample script and demonstration image, enabling efficient and flexible data manipulation.

Introduction

Google Apps Script is a versatile tool that allows for seamless management of various Google Workspace applications, including Docs, Sheets, Slides, Forms, and APIs. Its ability to automate tasks within Google Sheets is particularly powerful.

Analyzing Trends of Google Apps Script from Questions on Stackoverflow using Gemini 1.5 API

Gists

Analyzing Trends of Google Apps Script from Questions on Stackoverflow using Gemini 1.5 API

Abstract

A new large language model (LLM) called Gemini with an API is now available, allowing developers to analyze vast amounts of data. This report explores trends in Google Apps Script by using the Gemini 1.5 API to analyze questions on Stack Overflow.

Introduction

The release of the LLM model Gemini as an API on Vertex AI and Google AI Studio has opened a world of possibilities. Ref The Gemini API significantly expands the potential of various scripting languages, paving the way for diverse applications. Additionally, Gemini 1.5 has recently been released in AI Studio. Ref We can expect the Gemini 1.5 API to follow suit soon.

Generating Texts using Files Uploaded by Gemini 1.5 API

Gists

Generating Texts using Files Uploaded by Gemini 1.5 API

Abstract

The Gemini API allows the generating of text from uploaded files using Google Apps Script. It expands the potential of various scripting languages for diverse applications.

Introduction

With the release of the LLM model Gemini as an API on Vertex AI and Google AI Studio, a world of possibilities has opened up. Ref The Gemini API significantly expands the potential of various scripting languages and paves the way for diverse applications. Also, recently, Gemini 1.5 in AI Studio has been released. Ref In the near future, Gemini 1.5 API will be also released soon.

Crafting Bespoke Output Formats with Gemini API

Gists

Crafting Bespoke Output Formats with Gemini API

Abstract

The Gemini API unlocks potential for diverse applications but requires consistent output formatting. This report proposes a method using question phrasing and API calls to craft a bespoke output, enabling seamless integration with user applications. Examples include data categorization and obtaining multiple response options.

Introduction

With the release of the LLM model Gemini as an API on Vertex AI and Google AI Studio, a world of possibilities has opened up. Ref The Gemini API significantly expands the potential of various scripting languages and paves the way for diverse applications. However, leveraging the Gemini API smoothly requires consistent output formatting, which can be tricky due to its dependence on the specific question asked.