Overview
This is a CLI tool to interactively rearrange a text data on a terminal.
Description
Since I couldn’t find CLI tools for manually rearranging text data, I created this CLI tool.
For this, at first, I created a Golang library go-rearrange.

The detail information and how to get this are https://github.com/tanaikech/gorearrange.
Gists
onEdit(e) which is used for the Edit event on Spreadsheet has the old value as e.oldValue. The specifications for this are as follows.
- When an user edited a single “A1” cell,
e of onEdit(e) shows hoge for e.oldValue and fuga for e.value.
- When an user edited the “A1:A2” multiple cells,
e.oldValue and e.value of onEdit(e) are not shown anything.
- When an user copied and pasted from other cell,
e.oldValue and e.value of onEdit(e) are not shown anything.
This sample script was created to retrieve both the edited values and the old values for the range of edited cells. This is the modified e.oldValue.
OnedriveApp was updated to v1.1.0.
From this version, retrieving access token and refresh token became more easy.

GitHub of OnedriveApp
Gists
This sample script is for uploading CSV file as Spreadsheet and modifying permissions using Golang.
I think that the detail information of google-api-go-client is a bit little. The sample scripts are so little. It retrieves most information from only godoc and GitHub. So I publish such sample scripts here. If this is useful for you, I’m glad.
Important points :
- Give mimeType of file that it wants to upload to
options of Media(r io.Reader, options ...googleapi.MediaOption).
- In order to give
options, use googleapi.ContentType().
- Give mimeType of file that it wants to convert, when it uploads it to Google Drive, to
file of Create(file *File).
- In order to give
file, use &drive.File{}.
- For installing permissions, use
&drive.Permission{}. Each parameter is the same to them for Python.
This sample script uses Quickstart. So in order to use this sample script, at first, please do Step 1 and Step 2 of the Quickstart.
Gists
This is a sample script for selecting files in Google Drive using HTML select box for Google Apps Script.
Feature
Feature of this sample.
- It is a simple and space saving.
- When the folder is selected, the files in the folder are shown.
- When the file is selected, the ID of file is retrieved. Users can use this ID at GAS.
- When a folder is opened, all files in the folder are cached. By this, the second access of the folder is faster.
- It doesn’t retrieve all files in Google Drive at once, so the read of files from Google Drive becomes the minimum necessary.
I will use this for applications that users need to select files on Google Drive.
Gists
Flow :
In my sample script, the script was made using the Quickstart. The flow to use this sample script is as follows.
- For Go Quickstart, please do Step 1 and Step 2.
- Please put
client_secret.json to the same directory with my sample script.
- Copy and paste my sample script, and create it as new script file.
- Run the script.
- When
Go to the following link in your browser then type the authorization code: is shown on your terminal, please copy the URL and paste to your browser. And then, please authorize and get code.
- Put the code to the terminal.
- When
Done. is displayed, it means that the update of spreadsheet is done.
Request body :
For Spreadsheets.Values.BatchUpdate, BatchUpdateValuesRequest is required as one of parameters. In this case, the range, values and so on that you want to update are included in BatchUpdateValuesRequest. The detail information of this BatchUpdateValuesRequest can be seen at godoc. When it sees BatchUpdateValuesRequest, Data []*ValueRange can be seen. Here, please be carefull that Data is []*ValueRange. Also ValueRange can be seen at godoc. You can see MajorDimension, Range and Values in ValueRange.
ggsrun was updated to v.1.3.1
- Recently, when scripts on local PC is uploaded to Google Drive as a new project, the time to create on Google became a bit long. (I think that this is due to Google Update.) Under this situation, when the script is uploaded, the timeout error occurs while the new project is created using the script. So the time until timeout of fetch was modified from 10 seconds to 30 seconds. By this, when the script is uploaded, no error occurs and the information of the created project is shown.
- You can create a new project on Google Drive using scripts on local PC. The sample command is
ggsrun u -f sample.gs1,sample2.gs,sample3.html -pn newprojectname
You can check this and download ggsrun at https://github.com/tanaikech/ggsrun.
Gist
This sample script is for uploading image files to Slack using Incoming Webhooks by Google Apps Script.
When users try to upload image files to Slack using Incoming Webhooks, it has been known that although the access token is required to directly upload them, Incoming Webhooks can upload them by using the tag of image_url. In this sample script, it uploads image files (BMP, GIF, JPEG and PNG) on Google Drive to Slack using Incoming Webhooks. The script is written by Google Apps Script.
Gists
This sample script is for retrieving files with filename included special characters using Google Apps Script. The files are used on Google Drive.
The files with filename of special characters cannot be retrieved using DriveApp.getFilesByName(). This workaround solved this.
As a query parameter, name contains 'filename with special characters' is used. This contains is very important. name='filename with special characters' cannot retrieve such files. Today, it was found that name contains 'filename with special characters' is the workaround. I have been looking for this workaround for a while. Finally, I found this today. By using this method, filename included umlauts can be also retrieved.
Gists
This sample script is for removing duplicated values in array using CoffeeScript.
ar = ["a", "b", "c", "a", "c"]
res = ar.filter (e, i, s) -> s.indexOf(e) is i
console.log res
>>> [ 'a', 'b', 'c' ]
The result which was compiled by CoffeeScript is as follows.
var ar, res;
ar = ["a", "b", "c", "a", "c"];
res = ar.filter(function(e, i, s) {
return s.indexOf(e) === i;
});
console.log(res);