goodls was updated to v.1.0.3
The detail information and how to get this are https://github.com/tanaikech/goodls.
FilesApp was updated to v1.0.1.
- Removed a bug.
- When there are files and folders without the parents, an error occurred. In this version, this issue was removed.
GitHub of FilesApp
Overview
DownloadLargeFilesByUrl is a GAS library for downloading large files from URL to Google Drive using Google Apps Script (GAS).
Description
I had been thinking of about whether a large file from an URL can be downloaded to Google Drive using GAS. When I have tried to download such large files, I noticed the following limitations. These limitations are due to the specification of GAS.
- When users download a file from URL using GAS, at the most users, it retrieves the blob using
UrlFetchApp.fetch(url).getBlob() and saves it as a file using DriveApp.createFile(blob). In this case, only files less than 50 MB (52,428,800 bytes) can be created, because of the size limitation of Blob.
- There are a limit executing time for Google Apps Script (GAS). That is 6 min/execution.
- There are a limit of total executing time for running scripts by triggers. That is 90 min/day. (Recently, it became from 60 min/day to 90 min/day.)
When it tries to create the application for downloading the large files, it is required to consider above limitations. On the other hand, there are the following relaxations of quotas by the recent Google’s update.
Gists
Overview
This is sample scripts for copying files to a specific folder in Google Drive using Google Apps Script (GAS).
Description
When the files in Google Drive are copied to a specific folder using GAS, most users will use makeCopy(destination). When the files are copied using makeCopy(), you might have already noticed that only the standalone projects cannot be copied to the specific folder. They are copied to the root folder (My Drive). Also this situation can be also seen even when “copy” of Drive API v2 and v3 is used. I think that this might be a bug. So I would like to introduce 2 sample scripts as the workaround. In the workaround, it uses Drive API.
Gists
This is a sample script for replacing text to image for Google Document using Google Apps Script (GAS). There is a method for replacing text to text at Class Text of DocumentApp. But there are not methods for replacing text to image. So I created this sample script.
Demo :

This sample image was created by k3-studio.
Usage :
replaceTextToImage(body, replaceText, image, width);
body : body of document. You can set by DocumentApp.getActiveDocument().getBody() and DocumentApp.openById(documentId).getBody().
replaceText : string you want to replace.
image : blob of image you want to replace.
width : Width of replaced image. The aspect ratio is constant. The unit is pixels. If you don’t use this, the original size is used.
Script :
In this sample script, all strings of “sample” in the document are replaced to image with the file ID of imageFileId.
Gists
News
At October 11, 2019, I published a Javascript library to to run the resumable upload for Google Drive. When this is used, the large file can be uploaded. You can also use this js library.
Description
This is a sample script for uploading files to Google Drive using Javascript. The files are uploaded by Drive API v3. gapi.client.drive.files.create() can create an empty file on Google Drive. But it cannot directly upload files including contents. I think that this might not be able to upload files and metadata with the multipart/related, although this might be resolved by the future update. So now, as one of workarounds, I use using XMLHttpRequest.
Gists
Benchmark: Decreasing Loop for Array Processing using Google Apps Script
August 11, 2018
Published.
Kanshi Tanaike
Introduction
Please be careful! This result can be only used for Google Apps Script.
There are a limit executing time for Google Apps Script (GAS). That is 6 minutes. 1 So users always have to pay attention to reducing the process cost of the scripts. Especially, it is very important to know the process cost for the array processing, because the array processing is often used for spreadsheet and Google APIs. I have already reported the process costs for various processes as reports. 2-7 In this report, the process cost of “Decreasing loop” for the array processing using GAS has been investigated.
Gists
This is a sample script for retrieving screen shots of sites using Google Apps Script. In order to retrieve the screen shot, here, I used PageSpeed API.
When you use this, please copy and paste the following script, and set an URL you want to retrieve a screen shot.
var siteUrl = "### URL you want to retrieve a screen shot. ###";
var url =
"https://www.googleapis.com/pagespeedonline/v4/runPagespeed?screenshot=true&fields=screenshot&url=" +
encodeURIComponent(siteUrl);
var res = UrlFetchApp.fetch(url).getContentText();
var obj = JSON.parse(res);
var blob = Utilities.newBlob(
Utilities.base64DecodeWebSafe(obj.screenshot.data),
"image/png",
"sample.png"
);
DriveApp.createFile(blob);
Note :
- Retrieved value of screen shot is a base64 data with Web Safe.
- In my environment, when I ran this script as a test, it was not required to enable this API at API console. And also I used no API key. If you want to retrieve values from a lot of URLs, it might be required to enable API and use API key.
Updated at December 9, 2021
Now, version 5 can be used. The script is as follows. In this case, please add the scope as the value of openid. By this, the access token can be used. Although this sample script uses the access token, of course, you can also use the API key instead of the access token.
OnedriveApp was updated to v1.1.1.
I have to apologize you and all users.
I had forgot that it added setProp(). I could notice about this by reporting at here.
I would like to report because I could remove this bug.
GitHub of OnedriveApp
Overview
RangeListApp is a GAS library for retrieving, putting and replacing values for Spreadsheet by a range list with a1Notation using Google Apps Script (GAS).
Description
There is Class RangeList as one of classes for Spreadsheet. There is setValue(value) in Class RangeList as a method. setValue(value) puts value to the cells of range list. Recently, when I used this method, I noticed that the following situations what I want cannot be achieved.