RearrangeScripts was updated to v2.1.1 v2.1.1 (Match 2, 2018)
Added a notification to turn on the switch for using Google Apps Script API. This was reported to issuetracker. https://issuetracker.google.com/issues/74048155 Acknowledgements: Alan Wells Add-on GitHub
Overview This is a CLI tool to retrieve data from a personal weather station of Netatmo.
Description I have a personal weather station of Netatmo. I check the data of my local environment using it. In most case, I have used my browser to retrieve the data so far. About retrieving data using curl, I have created it before. Recently, I thought that I wanted to create this as a CLI too.
Gists
In the case appending values to cell by inserting rows, when sheets.spreadsheets.values.append is used, the values are appended to the next empty row of the last row. If you want to append values to between cells with values by inserting row, you can achieve it using sheets.spreadsheets.batchUpdate.
When you use this, please use your access token.
Endpoint : POST https://sheets.googleapis.com/v4/spreadsheets/### spreadsheet ID ###:batchUpdate Request body : In this request body, it appends the data of “sample1, sample2, sample3” to “A1:A3” of the sheetId of “1234567890”.
Gists
This is a sample script for transposing JSON object using Google Apps Script.
Input data : [ {"key1":"a1","key2":"a2","key3":"a3","key4":"a4","key5":"a5"}, {"key1":"b1","key2":"b2","key3":"b3","key4":"b4","key5":"b5"}, {"key1":"c1","key2":"c2","key3":"c3","key4":"c4","key5":"c5"}, {"key1":"d1","key2":"d2","key3":"d3","key4":"d4","key5":"d5"}, {"key1":"e1","key2":"e2","key3":"e3","key4":"e4","key5":"e5"} ] Output data : { "key1": ["a1", "b1", "c1", "d1", "e1"], "key2": ["a2", "b2", "c2", "d2", "e2"], "key3": ["a3", "b3", "c3", "d3", "e3"], "key4": ["a4", "b4", "c4", "d4", "e4"], "key5": ["a5", "b5", "c5", "d5", "e5"] } Script : At first, keys have to be defined by yourself, because the order of json is not decided.
Gists
This is a sample script for transposing slice from (n x m) to (m x n) for golang.
Script : package main
import "fmt"
func transpose(slice [][]string) [][]string {
xl := len(slice[0])
yl := len(slice)
result := make([][]string, xl)
for i := range result {
result[i] = make([]string, yl)
}
for i := 0; i < xl; i++ {
for j := 0; j < yl; j++ {
result[i][j] = slice[j][i]
}
}
return result
}
func main() {
sample := [][]string{
[]string{"a1", "a2", "a3", "a4", "a5"},
[]string{"b1", "b2", "b3", "b4", "b5"},
[]string{"c1", "c2", "c3", "c4", "c5"},
}
ar := transpose(sample)
fmt.