Gists
This is a sample script for sorting the cells on Google Spreadsheet with the background colors using Google Apps Script.
Unfortunately, in the current stage, it seems that sort(sortSpecObj) of Class Range cannot directly sort by the background colors of cells. But when Sheets API is used, this goal can be achieved. Here, “SortRangeRequest” of the method of “spreadsheets.batchUpdate” in Sheets API is used.
Flow The flow of this sample script is as follows.
Gists
Introduction At Stackoverflow, a lot of people post the questions and answer to the questions every day. By this, there are a lot of important information in Stackoverflow. I have already reported “Trend of google-apps-script Tag on Stackoverflow” using the data retrieved from Stackoverflow. Ref. 1 It is found that the important statistical result can be obtained by analyzing the data on Stackoverflow. In this report, I would like to introduce the statistical analysis of duplicated questions for the google-apps-script tag in Stackoverflow.
Gists
This is a sample script for setting alternate background colors for rows in Google Spreadsheet using Google Apps Script.
It has already been known when the conditional formatting rule and custom function are used, this can be simply achieved. Ref In this report, I would like to introduce the method for using Google Apps Script.
Sample script In this sample script, the values of column “A” are checked.
function myFunction() { const colors = { color1: "#f4cccc", color2: "#d9ead3" }; const sheet = SpreadsheetApp.
Gists
This is a sample Google Apps Script for running the specific function when the specific sheet is edited.
Sample script Please copy and paste the following script to the container-bound script of Spreadsheet and set sheets object.
// When the cells are edited, this function is run by the fire of event trigger. function onEdit(e) { // Please set the sheet name and function as follows. const sheets = { Sheet1: functionForSheet1, // Sheet1 is the sheet name.
Gists
Introduction Here, I would like to report the process costs for searching values in Spreadsheet using Google Apps Script (GAS). When the values are searched in Google Spreadsheet, the following 3 patterns can be considered. Ref
Retrieve all values using getValues, and the values are searched from the retrieved array. Use TextFinder. Use Query language. In these cases, it has already been found that the lowest process cost is to use the Query language.