Skip to content

Instantly share code, notes, and snippets.

Avatar

Kanshi TANAIKE tanaikech

View GitHub Profile
@tanaikech
tanaikech / submit.md
Created Jan 13, 2021
Creating Custom Grid View of Google Slides as Image and Spreadsheet using Google Apps Script
View submit.md

Creating Custom Grid View of Google Slides as Image and Spreadsheet using Google Apps Script

This is a sample script for creating the custom grid view of Google Slides as an image using Google Apps Script.

Demo

Usage

@tanaikech
tanaikech / submit.md
Created Jan 10, 2021
Adding Slide Page Link to Shape using Google Apps Script
View submit.md

Adding Slide Page Link to Shape using Google Apps Script

This is a sample script for adding the slide page link to the shape using Google Apps Script.

When I use Google Slides, there is the case that I want to jump to the specific slide on the same Google Slides. And, I have the case that I want to jump from the last slide to the 1st slide. In those cases, I had manually added the slide page link to each shape. But when the number of slides are large, I thought that when a script for achieving this is prepared, it will be useful. So I created this.

Demo

@tanaikech
tanaikech / submit.md
Last active Jan 6, 2021
Simple Script of Resumable Upload with Google Drive API for Axios
View submit.md

Simple Script of Resumable Upload with Google Drive API for Axios

This is a simple sample script for achieving the resumable upload to Google Drive using Axios. In order to achieve the resumable upload, at first, it is required to retrieve the location, which is the endpoint of upload. The location is included in the response headers. After the location was retrieved, the file can be uploaded to the location URL.

In this sample, a text data is uploaded with the resumable upload using a single chunk.

Upload Data using Single Chunk

This sample script achieves the resumable upload using a single chunk.

Sample script

@tanaikech
tanaikech / submit.md
Created Jan 5, 2021
Downloading and Uploading File to Google Drive without Saving File with Stream and Resumable Upload using Node.js
View submit.md

Downloading and Uploading File to Google Drive without Saving File with Stream and Resumable Upload using Node.js

This is a sample script of Node.js for downloading the data and uploading the data to Google Drive with the resumable upload without saving it as a file. The downloaded data is uploaded to Google Drive with the stream.

Sample script

Before you use this, please set the variables of accessToken, url, fileSize, mimeType and filename. In this case, fileSize is required to set because the data is uploaded with the resumable upload.

const request = require("request");
@tanaikech
tanaikech / submit.md
Last active Jan 10, 2021
Retrieving Access Token for Service Account using Javascript
View submit.md

Retrieving Access Token for Service Account using Javascript

This is a sample script for retrieving the access token for Service Account using Javascript. The flow for using this script is as follows.

  1. At first, please create the Service Account and retrieve JSON file.
  2. Put Scopes, private_key and client_email to the script.
  3. Run the script.

Sample script

In this script, 2 libraries of jsencrypt and crypto-js are used.

@tanaikech
tanaikech / submit.md
Created Dec 7, 2020
Uploading Image Files to Google Photos using axios
View submit.md

Uploading Image Files to Google Photos using axios

This is a sample script for uploading the image files to the specific album in Google Photos using axios.

Before you use this script, please retrieve the access token for uploading the files using Google Photos API.

Sample script

In this sample script, several image files can be uploaded.

@tanaikech
tanaikech / submit.md
Last active Dec 6, 2020
Achieving Search of Files by 'is:unorganized owner:me' using Google Apps Script
View submit.md

Achieving Search of Files by 'is:unorganized owner:me' using Google Apps Script

This is a sample script for achieving the search of files by is:unorganized owner:me using Google Apps Script.

In the current stage, unfortunately, the files cannot be directly retrieved by searching is:unorganized owner:me with Drive API and Drive service. So as the current workaround, all files are retrieved using the method of "Files: list" of Drive API with 'me' in owners and trashed = false, and the file list is retrieved from all file list using a script.

Sample script

Before you use this script, please enable Drive API at Advanced Google services. And please run main() function.

@tanaikech
tanaikech / submit.md
Created Dec 3, 2020
Sample Scripts for Creating New Event with Google Meet Link to Google Calendar using Various Languages
View submit.md

Sample Scripts for Creating New Event with Google Meet Link to Google Calendar using Various Languages

This is the sample scripts for creating new event with Google Meet link to Google Calendar using various languages. When I saw the official document of "Add video and phone conferences to events", in the current stage, I can see only the sample script for Javascript. But I saw the several questions related to this for various languages. So I published the sample scripts for creating new event with Google Meet link to Google Calendar using various languages.

In order to create new event with Google Meet link to Google Calendar, it is required to set the request body and query parameter as follows.

Please add the following object to the request body.

conferenceData: {
@tanaikech
tanaikech / submit.md
Created Nov 23, 2020
Downloading Active Sheet in Google Spreadsheet as CSV and PDF file by Clicking Button
View submit.md

Downloading Active Sheet in Google Spreadsheet as CSV and PDF file by Clicking Button

This is a sample script for downloading the active sheet in Google Spreadsheet to the local PC as a CSV file and a PDF file when a button on the side bar and the dialog is clicked. This is created with Google Apps Script and HTML&Javascript. In this post, the script of the previous post was modified.

Sample script

Please create new Google Spreadsheet and copy and paste the following scripts to the script editor. And please run openSidebar(). By this, the side bar is opened to the Spreadsheet.

@tanaikech
tanaikech / submit.md
Last active Nov 20, 2020
Converting Texts to Bold, Italic and Bold-Italic Types of Unicode using Google Apps Script
View submit.md

Converting Texts to Bold, Italic and Bold-Italic Types of Unicode using Google Apps Script

This is a sample script for converting the texts to the bold, italic, bold-italic types, underline and strike through of the unicode using Google Apps Script. In the current stage, at Google Docs (Spreadsheet, Document, Slides and so on), the rich texts cannot be directly managed for all places using Google Apps Script. But there are the places which can use the bold, italic and bold-italic fonts with the unicode. This sample script uses this. When this sample script is used, for example, the bold, italic and bold-italic texts can be put using SpreadsheetApp.getUi().alert(convertedText).

Sample script

const conv = {