Sample data This is a sample data for this sample script. The column B was created by the normal distribution formula, and the column C was created by multiplying random number for column B.
A, B, C 1.0, 0.0001, 0.0000 1.5, 0.0009, 0.0006 2.0, 0.0044, 0.0037 2.5, 0.0175, 0.0133 3.0, 0.0540, 0.0236 3.5, 0.1296, 0.0533 4.0, 0.2420, 0.0073 4.5, 0.3522, 0.2468 5.0, 0.3990, 0.0843 5.5, 0.3522, 0.3352 6.0, 0.2420, 0.2201 6.
This sample script sends an e-mail, when spreadsheet was edited from outside by Sheet API v4. When you use this sample, please create a container bound script with spreadsheet which is edited by Sheet API. And please input your e-mail and run firstly a method of createTrigger(). By this, a trigger is installed as onChange(). After this, edit spreadsheet from outside by Sheet API v4.
When when spreadsheet was edited from outside by Sheet API v4, I used sendEmail() as a sample, because script editor is closed.
Overview In this article, I would like to introduce how to transfer files for Google Drive under no authorization.
This has also been published here. https://github.com/tanaikech/FileTransfer
Description When we download and upload files for Google Drive, it usually has to use Drive API. In order to use Drive API, access token is required. If you want to make your friends download and upload files for your Google Drive, the authorization process is to take time.
This sample script dynamically creates nested JSON objects.
Script obj := map[string]interface{}{} for i := 1; i <= 5; i++ { value := map[string]interface{}{ fmt.Sprintf("B_key%d", i): map[string]interface{}{ "C_key": "value", }, } obj[fmt.Sprintf("A_key%d", i)] = value } Result { "A_key1": { "B_key1": { "C_key": "value" } }, "A_key2": { "B_key2": { "C_key": "value" } }, "A_key3": { "B_key3": { "C_key": "value" } }, "A_key4": { "B_key4": { "C_key": "value" } }, "A_key5": { "B_key5": { "C_key": "value" } } }
This script changes slack status using GAS. If you want to change it on time you decided, it can be achieved by installing this method as a trigger.
In order to use this, the required scope is users.profile:write.
function setSlackStatus(token, user, status_text, status_emoji) { return UrlFetchApp.fetch( 'https://slack.com/api/users.profile.set', { method: 'post', payload: { token: token, user: user, profile: JSON.stringify({status_text: status_text, status_emoji: status_emoji}) }, muteHttpExceptions: true } ).