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

The Thinker

When '//' in template literal is used in a HTML file in script editor, it is used as a comment start

Gists Overview When // in template literal is used in a HTML file in script editor, it is used as a comment start. const sample = `//`; For example, when above script is used in a HTML file at the script editor, ;" of const sample =`//`; is used as the comment. Description I would like to explain about this bug using the following sample flow. Flow Create new Spreadsheet and open the script editor.

Workaround for Retrieving Direct Links of All Sheets from URL of 2PACX- of Web Published Google Spreadsheet

Gists This is a sample script for retrieving the direct links of all sheets from the URL like https://docs.google.com/spreadsheets/d/e/2PACX-###/pubhtml of the web published Google Spreadsheet. This sample script can be used for the following situation. The Spreadsheet is published to Web and the URL like https://docs.google.com/spreadsheets/d/e/2PACX-###/pubhtml is known You are not the owner of Google Spreadsheet. You don’t know the Spreadsheet ID and Sheet IDs. Under above situation, unfortunately, the direct links of each sheet cannot be directly retrieved.

Updated: CLI Tool - goris

goris is a CLI tool to search for images with Google Reverse Image Search. Today, it was updated to v2.0.0. Please check it out. https://github.com/tanaikech/goris v2.0.0 (April 23, 2020) The specification for running the reverse image search was changed at Google side. By this, this application was also changed.

Updating a File with Resumable Upload using Drive API

Gists This is a sample flow for updating a file with the resumable upload using Drive API. Sample situation: In this answer, as a sample situation, it supposes that a text file in Google Drive is updated by the resumable upload with the multiple chunks. And as the method for requesting, I use the curl command. I prepared 2 files for 2 chunks. As the test situation, the 2 chunks of 262,144 bytes and 37,856 bytes are uploaded.

Limitation of Array.prototype.push.apply under V8 for Google Apps Script

Gists Description When V8 is enabled, Array.apply has the limitation for the number of elements. When it is over the limitation, an error like RangeError: Maximum call stack size exceeded occurs, while the issue didn’t occur when V8 is disabled. In this case, this issue occurs at both Google Apps Script and Javascript. So please be careful this. Sample situation For example, when Array.prototype.push.apply is used for combining the arrays because the process cost of Array.