Gists
Published: January 3, 2023
Kanshi Tanaike
Introduction At Stackoverflow, a lot of people post questions and answers to the questions every day. There are various tags in Stackoverflow. A lot of discussions are performed at each tag. Their discussions bring important information and are much useful for a lot of people. As one of the tags, there is “google-apps-script”. I sometimes discuss the questions with that tag. When we see the discussions, we can notice that the discussions are changed and progressed over time, because “Google Apps Script” which is the origin of the tag is updated.
Gists
This is a simple sample script for filtering JSON objects using Google Apps Script.
In the current stage, V8 runtime can be used with Google Apps Script. By this, when you want to filter a JSON object, you can use the following sample script.
Sample script In this sample script, obj is filtered by the value of the even number.
const obj = { key1: 1, key2: 2, key3: 3, key4: 4, key5: 5 }; const res = Object.
Gists
This sample script decrypts the salted base64 data of finance.yahoo.com using Google Apps Script.
Recently, when I saw the HTML of finance.yahoo.com, I noticed that the data is converted by the salted base64. In order to decrypt the data, it is required to use the key data. But, unfortunately, I couldn’t find the key data from the HTML. When I searched for it, I found this thread. From the thread, I could retrieve the key data.
Gists
This is a sample script for encrypting and decrypting with AES using crypto-js with Google Apps Script.
Unfortunately, in the current stage, Google Apps Script cannot encrypt and decrypt AES using the built-in functions. In this post, in order to achieve this, “crypto-js” is used from cdnjs.com ( https://cdnjs.com/libraries/crypto-js ). In the current stage, it seems that the main functions of crypto-js.min.js can be directly used with Google Apps Script.
Gists
This is a sample script for rearranging columns on Google Spreadsheet using Google Apps Script.
Sample script In this sample script, the initial columns of “header1”, “header2”, “header3”, “header4” and “header5” are rearranged to “header2”, “header5”, “header1”, “header4”, “header3”. This result can be seen at the above image.
As an important point, in this script, the header titles in the 1st row are used. Please be careful about this.