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

The Thinker

Updated: Go Library - go-getfilelist to v200

go-getfilelist was updated to v2.0.0

  • v2.0.0 (February 25, 2022)

    1. By changing the specification of methods, drive.New() and transport.APIKey were deprecated. By this, I updated the specification of this library as the version 2. When you are required to continue to use drive.New() and transport.APIKey, you can use them with the version 1. At version 1, *http.Client is given to this library. From version 2, *drive.Service is given instead of *http.Client. Please be careful this. You can see the sample script at the above.

You can get this from https://github.com/tanaikech/go-getfilelist

Counter in Cell of Google Spreadsheet using Infinite Loop with Google Apps Script

Gists

This is a sample script of a counter in a cell of Google Spreadsheet using the infinite loop with Google Apps Script. Recently, I have reported about the infinite loop on Google Spreadsheet. Ref This sample script achieves a counter in a cell using the infinite loop.

Sample script

This sample script is a test script for counting the number using the infinite loop. Please be careful this. Please copy and paste the following script to the script editor of Google Spreadsheet and save it. And, please install OnChange trigger to the function onChange().

Report: Occurring and Resolving Infinite Loop on Google Spreadsheet using Google Apps Script

Gists

Here, I would like to introduce a report for occurring and resolving the infinite loop on Google Spreadsheet using Google Apps Script. I have reported this to Google issue tracker. Ref

Sample script: Occurring infinite loop

This sample script is a test script for confirming the infinite loop. Please be careful this. Please copy and paste the following script to the script editor of Google Spreadsheet and save it. And, please install OnChange trigger to the function onChange().

Report: Inserting Multiple Paragraphs to Google Document in Order using Google Docs API

Gists

This is a report for inserting the multiple paragraphs to Google Document in order using Google Docs API.

When the multiple paragraphs are inserted to Google Document using Google Docs API, it is required to pay attention to the index for inserting the texts. In this report, I would like to introduce the points for achieving this with a simple method.

Although this report uses Google Apps Script, the logic of this method can be used for other language.

GAS Library - HtmlFormApp

Overview

This is a Google Apps Script library for parsing the form object from HTML form and appending the submitted values to the Spreadsheet.

Description

There is Google Form in the Google service. Google Form can parse the submitted data and put it in the Spreadsheet. But when we want to use the custom form, it is required to use the HTML form on Web Apps, dialog, and sidebar. In this case, it is required to prepare Javascript and Google Apps Script for parsing the form object from the HTML form and appending the parsed values to Spreadsheet. Recently, a bug of the built-in parser from the Javascript side to the Google Apps Script side for parsing the form object from the HTML form had been removed. Ref But, in the current stage, this bug is removed for only Web Apps. Unfortunately, for the dialog and sidebar, this bug has never been removed. And also, unfortunately, the built-in parser from the Javascript side to the Google Apps Script side cannot be used for the multiple files of the input tag. And, this cannot be used except for google.script.run. For example, when the HTML form including the files is submitted using “action” of the form tag, the file content is not included. And then, when the form object is retrieved, it is required to parse the object and put it in the Spreadsheet. From these situations, I thought that when this process can be run using the libraries, that might be useful for users. So I created this.