Skip to content

Instantly share code, notes, and snippets.

Avatar

Kanshi TANAIKE tanaikech

View GitHub Profile
@tanaikech
tanaikech / submit.md
Last active May 1, 2021
Retrieving Access Token using Service Account for PHP without using googleapis
View submit.md

Retrieving Access Token using Service Account for PHP without using googleapis

This is a sample PHP script to retrieve the access token from Service Account of Google without using googleapis.

Sample script

<?php

$private_key = "-----BEGIN PRIVATE KEY-----\n###-----END PRIVATE KEY-----\n"; // private_key of JSON file retrieved by creating Service Account
@tanaikech
tanaikech / submit.md
Created Apr 28, 2021
Changing Font of Selected Text to 'Google Sans' on Google Document using Google Apps Script
View submit.md

Changing Font of Selected Text to 'Google Sans' on Google Document using Google Apps Script

This is a sample script for changing the font of selected text to Google Sans on Google Document using Google Apps Script.

Sample script

Please copy and paste the following script to the script editor of Google Document And, when you use this script, please select a text in Google Document and run the script. By this, the font of selected text is changed to Google Sans.

@tanaikech
tanaikech / submit.md
Created Apr 27, 2021
Specification of Search Query for File List Method in Drive API
View submit.md

Specification of Search Query for File List Method in Drive API

In this report, I would like to report about the current specification of the search query for the file list method in Drive API.

Recently, I noticed that the specification of the search query for the file list method in Drive API might have been changed. I thought that to know the change of specification of the search query is important for creating the application using Drive API. In this report, I would like to introduce the current specification of the search query.

Experiments

I have done the following 5 experiments.

@tanaikech
tanaikech / submit.md
Created Apr 19, 2021
Creating Colorful Buttons on Google Spreadsheet using Google Apps Script
View submit.md

Creating Colorful Buttons on Google Spreadsheet using Google Apps Script

This is a sample script for creating the colorful buttons on Google Spreadsheet on Google Apps Script.

In order to achieve this, I have been looking for the method for creating the PNG image with the alpha channel using Google Apps Script. Recently, finally, I could find it. By this, the goal of this report got to be able to be achieved by the report of "Creating PNG Image with Alpha Channel using Google Apps Script".

Demo

@tanaikech
tanaikech / submit.md
Created Apr 6, 2021
A Bug of New IDE about Time Zone of Google Apps Script project was removed
View submit.md

A Bug of New IDE about Time Zone of Google Apps Script project was removed

I had confirmed a bug of new IDE about the time zone of Google Apps script project. When I created new Google Apps Script project using new IDE, the time zone of GAS project is always America/New_York. In my area, it's Asia/Tokyo. The time zone can be confirmed at appscript.json.

So, I had reported this issue to Google issue tracker. Ref After I posted this, I had also confirmed this issue at Stackoverflow. Ref

Today, I got a report from Google issue tracker. When I tested above, I could confirm that the issue was removed. When I created new Google Apps Script project, I confirmed that the value of timeZone in appsscript.json is Asia/Tokyo. So I reported this here.

@tanaikech
tanaikech / submit.md
Created Apr 2, 2021
Plotting Points on Image using Google Apps Script
View submit.md

Plotting Points on Image using Google Apps Script

This is a sample script for plotting the points on an image using Google Apps Script.

Unfortunately, in the current stage, there are no methods for directly editing the image and putting the texts and some shapes in the methods for Google Apps Script. So in this case, it is required to use the workaround.

Fortunately, I have already published a report about "Inserting Text on Image using Google Apps Script" in my blog. Ref In this report, this sample is used.

Usage

@tanaikech
tanaikech / submit.md
Last active Apr 13, 2021
Redeploying Web Apps without Changing URL of Web Apps for new IDE
View submit.md

Redeploying Web Apps without Changing URL of Web Apps for new IDE

At March 15, 2021, one endpoint is created for one deployment. Ref By this, when you redeploy "Web Apps", the endpoint is changed. Because the deployment ID is changed. It seems that this it the new specification. In this report, I would like to introduce the method for redeploying Web Apps without changing the URL of Web Apps for new IDE.

Deploy Web Apps

  1. Open "New deployment" dialog with "Deploy" -> "New deployment".

  2. Select "Web app" for "Select type".

@tanaikech
tanaikech / submit.md
Last active Mar 28, 2021
Copying Protections for Spreadsheet using Google Apps Script
View submit.md

Copying Protections for Spreadsheet using Google Apps Script

This is a sample script for copying the protections for Spreadsheet using Google Apps Script. When several protections of the sheet protection and the range protection are set to a Google Spreadsheet and the Spreadsheet is copied using the script and the manual copy with the browser, unfortunately, the protections of ranges are not copied. And also, the protections of sheets can be copied. But, the editor emails are not included. It seems that this is the current specification.

In this post, I would like to introduce a sample script for copying all protection conditions.

Sample script

Please add the following function to your script. And, please enable Sheets API at Advanced Google services.

@tanaikech
tanaikech / submit.md
Last active Feb 2, 2021
XPath Tester using Web Apps Created by Google Apps Script
View submit.md

XPath Tester using Web Apps Created by Google Apps Script

In this post, I would like to introduce the xpath tester using Web Apps created by Google Apps Script.

Demo

Usage

@tanaikech
tanaikech / submit.md
Created Jan 16, 2021
Trend of google-apps-script Tag on Stackoverflow 2021
View submit.md

Trend of google-apps-script Tag on Stackoverflow 2021

Published: January 16, 2021

Kanshi Tanaike

Introduction

At Stackoverflow, a lot of people post the questions and answers to the questions every day. There are various tags in Stackoverflow. A lot of discussions are performed at each tag. Their discussions bring the important information and are much useful for a lot of people. As one of tags, there is "google-apps-script". I sometimes discuss at the questions with that tag. When we see the discussions, we can notice that the discussions are changed and progressed by the time, because "Google Apps Script" which is the origin of the tag is updated. This report thinks this change as the trend of tag of "google-apps-script". This trend includes the number of questions, questioners, answerers and tags adding to the tag of "google-apps-script". The trend of tag of "google-apps-script" is deeply related to the progression of Google Apps Script and the various applications for Google Apps Script.