Skip to content

Instantly share code, notes, and snippets.

View tanaikech's full-sized avatar

Kanshi TANAIKE tanaikech

View GitHub Profile
@tanaikech
tanaikech / submit.md
Created June 15, 2017 04:58
Effect of Comprehension for GAS

Effect of Comprehension for GAS

Description

There are a limit executing time for Google Apps Script (GAS). It's 6 minutes. So users have to pay attention to the process cost of the script. GAS can use JavaScript 1.7. This means to be able to be used comprehension for GAS.

In this report, the process cost for the comprehension has been investigated. The normal for loop was used as the competitor. As a result, it was found that the comprehension can be used one of methods for reducing the process cost. For 1 dimensional array, the process cost of comprehension is about 60% lower than that of the normal one. For 2 dimensional array, the process cost of comprehension is about 50% lower than that of the normal one. Each data is the average for 10 times measurements.

@tanaikech
tanaikech / submit.md
Created June 15, 2017 04:59
Search Route and Embedding Map using Custom Function on Spreadsheet

Search Route and Embedding Map using Custom Function on Spreadsheet

This sample script is for searching route between place A and B and embedding a map by custom function on Spreadsheet.

I think that this method is one of various ideas.

Problem

When the map is embedded to a cell on spreadsheet as an image, the function =IMAGE() is suitable for this situation. However, Class Maps, setFormula() for importing =IMAGE() and DriveApp.createFile() for creating images from maps also cannot be used for custom functions.

Solution

@tanaikech
tanaikech / submit.md
Created June 15, 2017 05:07
File Transfer for Google Drive Without Authorization

File Transfer for Google Drive Without Authorization

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. So I proposal this.

@tanaikech
tanaikech / submit.md
Created June 15, 2017 05:09
Converting PDF to TXT

Converting PDF to TXT

This is a sample script for converting a PDF file to a TXT file. 2 steps are required for this.

  1. Upload a PDF file as a Google Document
  2. Download a Google Document as a TXT file

In this sample, Python Quickstart is used. The detail information is https://developers.google.com/drive/v3/web/quickstart/python. Please read "Step 1: Turn on the Drive API" and "Step 2: Install the Google Client Library".

@tanaikech
tanaikech / submit.md
Created June 15, 2017 05:10
Export CSV File from Spreadsheet and Make Download Button

Export CSV File from Spreadsheet and Make Download Button

This is a script to export a CSV file from spreadsheet and make an user download it. When the users download it, they can download by push a button made by this script.

In order to use this script, put both HTML and script in a GAS project.

html :

This file name is "download.html".

@tanaikech
tanaikech / submit.md
Created June 15, 2017 05:11
Retrieving Access Token for Google Drive API using GAS

Retrieving Access Token for Google Drive API using GAS

These GASs retrieve an access token for using Google Drive API. There are 3 parts. Before you use this, please retrieve client ID, client secret and redirect uri from Google , and choose scopes.

1. Retrieving code from web

This is a script to output URL for retrieving "code" from web. Please retrieve "code" by import this URL to your browser. After you run this script, using "url" got from this script, it retrieves "code".

 var url = 'https://accounts.google.com/o/oauth2/auth' +
@tanaikech
tanaikech / submit.md
Created June 15, 2017 05:12
Send E-mail with Excel file converted from Spreadsheet

Send E-mail with Excel file converted from Spreadsheet

This sample script sends an e-mail with an Excel file exported from Spreadsheet as an attachment file.

function excelSender() {
  var sheetID = [Sheet ID];
  var xlsxName = [Excel file name];
  var params = {
 "headers" : {Authorization: "Bearer [Retrieved AccessToken]"},
@tanaikech
tanaikech / submit.md
Last active January 27, 2021 18:12
Retrieving Access Token for Google APIs

Retrieving Access Token for Google APIs

This sample is for retrieving access token for Google APIs. I created this for studying newStateToken().

Preparation

In order to use this sample, please do as follows.

  1. Deploy and launch Web Apps for retrieving redirect uri
    • On the Script Editor
  • File
@tanaikech
tanaikech / submit.md
Last active December 27, 2023 04:13
Downloading Files From Google Drive Under No Authorization Using Browser

Downloading Files From Google Drive Under No Authorization Using Browser

This is a sample script for downloading files from Google Drive under no authorization using browser. By using this sample, you can make other users download files from your Google Drive. Even if the other users are not Google users, they can download the files.

Demo

@tanaikech
tanaikech / submit.md
Last active January 19, 2023 08:29
Pseudo Browser with Google Spreadsheet

Pseudo Browser with Google Spreadsheet

Overview

This is a sample script for creating the pseudo browser using Google Spreadsheet.

Description

I unexpectedly noticed this. I think that this is for off-line browsing using HTML data. So there are many limitations. At first, please confirm them.

  • Limitations
  • It cannot move from opened site to other outside site. If the outer site is opened as a new wind, your own browser is opened and move there.