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

The Thinker

Parsing JSON object (keys are number and changing every time)

Gists This sample script is for parsing JSON object. In the object, the keys are number and changing every time. Object: { "key1": { "key2": [ {"0": [{"key3": "value3a"}, {"key3": "value3b"}]}, {"1": [{"key3": "value3c"}, {"key3": "value3d"}]} ] } } Script: package main import ( "encoding/json" "fmt" "strconv" ) type key1 struct { Key1 key2 `json:"key1"` } type key2 struct { Key2 []interface{} `json:"key2"` } func main() { data := `{"key1": {"key2": [{"0": [{"key3": "value3a"}, {"key3": "value3b"}]},{"1": [{"key3": "value3c"}, {"key3": "value3d"}]}]}}` k1 := &key1{} json.

Adding a Label to a Message using Message ID for Gmail

Gists These are sample scripts for adding a label to a message using message ID for Gmail. Sample 1 This sample adds a label to a thread using message ID. In this case, all messages in the thread have the label. Even if it adds a label to a message in the thread using addLabel(), all messages in the thread have the label, becauce addLabel can only be used for the thread.

How to Retrieve Replied Emails for Gmail

Gists Description : This sample script is for retrieving emails which replied for received mails. Because there are no samples which confirm whether the owner (me) replied to the received mails, I created this. The point is as follows. When there are more than 2 messages in a thread, there might be a possibility to have replied. For more than 2 messages in a thread The email address of “from” for the 1st message is the sender’s address.

Updated: GAS Library - ManifestsApp

ManifestsApp was updated to v1.0.2. v1.0.2 (January 29, 2018) ProjectApp2 is published, and got to be able to use both standalone script type and container-bound script type. By this, this library also got to be able to be used for the both projects. For this update, please enable Apps Script API. Please check “How to install”. You can check this at https://github.