Gists
Abstract This is a Google Apps Script library for converting files from various MIME types to a specified target MIME type. The library accepts both file IDs and blobs as input values.
Introduction Recently, I encountered a scenario where I needed to convert files of various MIME types to a specific target MIME type. While converting files with known source MIME types is relatively straightforward, the process becomes more complex when the source MIME type is unknown.
GeminiWithFiles was updated to v2.0.3 v2.0.3 (November 19, 2024)
I modified the specification of setFileIdsOrUrlsWithResumableUpload. From v2.0.3, when you use this method, please include propertiesService: PropertiesService.getScriptProperties() into the initial object as follows. Because, when PropertiesService.getScriptProperties() is used in the library, the values are put into the library. When I created Ref and Ref, I supposed that the script is used by copying and pasting instead of the library.
GeminiWithFiles was updated to v2.0.2 v2.0.2 (September 26, 2024)
As the option for generationConfig, the properties response_schema and temperature were added. You can see the detail information here https://github.com/tanaikech/GeminiWithFiles
UtlApp was updated to v1.0.7. v1.0.7 (September 4, 2024)
Following 3 methods were added. snake_caseToCamelCase: This method is used for converting a string of the snake case to the camel case. camelCaseTosnake_case: This method is used for converting a string of the camel case to the snake case. createFormDataObject: This method is used for creating the form data to HTTP request from an object. You can see the detail information here https://github.
GeminiWithFiles was updated to v2.0.1 v2.0.1 (August 4, 2024)
From this version, codeExecution can be used. Ref You can see the detail information here https://github.com/tanaikech/GeminiWithFiles
GeminiWithFiles was updated to v2.0.0 v2.0.0 (August 3, 2024)
From this version, the following changes were made. PDF data can be directly used. Ref By this, PDFApp is not required to be used. By this, the script can be used without async/await. As the default, functions: {} is used. So, the default function calling was removed. Because in the current stage, JSON output can be easily returned using a JSON schema and response_mime_type.
GeminiWithFiles was updated to v1.0.7. v1.0.7 (July 4, 2024)
From this version, when doCountToken: true and exportTotalTokens: true are used in the object of the argument of geminiWithFiles, the total tokens are returned. In this case, the returned value is an object like {returnValue: "###", totalTokens: ###}. Ref You can see the detail information here https://github.com/tanaikech/GeminiWithFiles
TriggerApp was updated to v1.0.3. v1.0.3 (June 26, 2024)
The calculation for increasing the month was modified. A new scenario 8 was added. In scenario 8, you can see how to use the month-end. Ref You can see the detail information here https://github.com/tanaikech/TriggerApp
MoveFolder was updated to v1.0.1. v1.0.1 (June 18, 2024)
In the recent update on the Google side, it was found that in the current stage, when the other libraries are loaded from a library, an error like We're sorry, a server error occurred while reading from storage. Error code NOT_FOUND occurs. So, from v1.0.1, the library of BatchRequest is included in this library. You can see the detail information here https://github.
GeminiWithFiles was updated to v1.0.6. v1.0.6 (June 15, 2024)
Included the script of PDFApp in this library. You can see the detail information here https://github.com/tanaikech/GeminiWithFiles
GeminiWithFiles was updated to v1.0.5. v1.0.5 (June 7, 2024)
Spelling mistakes in the warning message were modified. The wait time for changing the value of state for the movie file is changed from 5 seconds to 10 seconds per cycle. You can see the detail information here https://github.com/tanaikech/GeminiWithFiles
Overview This is a Google Apps Script library for moving a folder including files and folders on Google Drive.
Description This library addresses a common challenge: efficiently moving folders, including their subfolders and files, between Google Drives. This encompasses both personal and shared drives using a script. While Google Drive offers straightforward methods for moving individual files between any drives, directly moving entire folders containing subfolders presents limitations, particularly when shared drives are involved.
FilesApp was updated to v1.1.4.
v1.1.4 (June 5, 2024)
A bug for retrieving metadata from the shared drive was removed. GitHub of FilesApp
GeminiWithFiles was updated to v1.0.4. v1.0.4 (May 29, 2024)
Recently, when model.countToken is used with the uploaded files, I confirmed that an error like You do not have permission to access the File ### or it may not exist. occurred. In order to handle this issue, I modified the library. In order to use the movie files for generateContent, I modified the library. Ref You can see the detail information here https://github.
ResumableUploadForGoogleDrive_js was updated to v2.0.2.
v2.0.2 (May 23, 2024)
From this version, the files could be also uploaded to the shared drive. CDN Class ResumableUploadToGoogleDrive This Class can achieve the resumable upload of a file by reading the file to the memory.
<script src="https://cdn.jsdelivr.net/gh/tanaikech/ResumableUploadForGoogleDrive_js@2.0.2/resumableupload_js.min.js"></script> Class ResumableUploadToGoogleDrive2 This Class can achieve the resumable upload of a file by directly reading partially the file from the local Disk.
GeminiWithFiles was updated to v1.0.3. v1.0.3 (May 17, 2024)
Bugs were removed. You can see the detail information here https://github.com/tanaikech/GeminiWithFiles
ImgApp was updated to v1.3.3.
v1.3.3 (May 16, 2024) In SlidesAppp.gs, added a script for checking whether Drive API and Slides API are enabled. Ref You can see the detail information here https://github.com/tanaikech/ImgApp
PDFApp was updated to v1.0.7. v1.0.7 (May 15, 2024)
The method of “addPageNumbers” was updated. Ref When a number is used to the property x instead of “left”, “center”, and “right”, the inputted number is directly used. You can see the detail information here https://github.com/tanaikech/PDFApp
PDFApp was updated to v1.0.6. v1.0.6 (May 15, 2024)
A new method of “addPageNumbers” was added. Ref This method adds the page numbers to each page of the PDF. You can see the detail information here https://github.com/tanaikech/PDFApp
GeminiWithFiles was updated to v1.0.2. v1.0.2 (May 7, 2024)
For generating content, parts was added. From this version, you can select one of q, jsonSchema, and parts. From this version, systemInstruction can be used. In order to call the function call, toolConfig was added to the request body. You can see the detail information here https://github.com/tanaikech/GeminiWithFiles
UtlApp was updated to v1.0.6. v1.0.6 (May 4, 2024)
Methods of blobToDataUrl was added. When this method is used, the Blob data can be converted to the data URL. You can see the detail information here https://github.com/tanaikech/UtlApp
GeminiWithFiles was updated to v1.0.1. v1.0.1 (May 2, 2024)
response_mime_type got to be able to be used for controlling the output format. Ref You can see the detail information here https://github.com/tanaikech/GeminiWithFiles
Overview This is a Google Apps Script library for Gemini API with files.
A new Google Apps Script library called GeminiWithFiles simplifies using Gemini, a large language model, to process unstructured data like images and PDFs. GeminiWithFiles can upload files, generate content, and create descriptions from multiple images at once. This significantly reduces workload and expands possibilities for using Gemini.
Description Recently, Gemini, a large language model from Google AI, has brought new possibilities to various tasks by enabling the use of unstructured data as structured data.
RichTextAssistant was updated to v1.0.1. v1.0.1 (April 22, 2024)
From oshliaer’s report, a bug was removed. In the current stage, when RichTextValueBuilder is used, it seems that when setTextStyle is used after setLinkUrl, the style of the hyperlink is removed while the link is kept. So, it is required to set setLinkUrl after setTextStyle. You can see the detail information here https://github.com/tanaikech/RichTextAssistant
UtlApp was updated to v1.0.5. v1.0.5 (April 16, 2024)
Methods of consolidateA1Notations was added. When this method is used, the scattered A1Notations can be consolidated. You can see the detail information here https://github.com/tanaikech/UtlApp
UtlApp was updated to v1.0.4. v1.0.4 (April 13, 2024)
Updated the methods of convGridRangeToA1Notation. When the sheet name is not given, only the A1Notation is returned. You can see the detail information here https://github.com/tanaikech/UtlApp
Overview This is a Google Apps Script library for supporting to use Google APIs with Google Apps Script.
Description There are numerous powerful Google APIs available today. Google Apps Script streamlines interacting with these APIs through a simplified authorization process. Additionally, advanced Google services integrate seamlessly with Apps Script, making Google APIs highly advantageous for users.
However, utilizing APIs beyond advanced Google services can be challenging for some users. Developing a simpler method for using various Google APIs would significantly increase their accessibility and empower a broader range of users to create diverse applications.
v1.2.3 (March 11, 2024)
Modified the URL of the application installed in Microsoft Azure.
GitHub of OnedriveApp
CorporaApp was updated to v1.0.3. v1.0.3 (March 6, 2024)
New method of getChunk was added. When this method is used, you can retrieve a single chunk using the resource name of chunk. You can see the detail information here https://github.com/tanaikech/CorporaApp
CorporaApp was updated to v1.0.2. v1.0.2 (February 26, 2024)
New method of setAccessToken was added. When this method is used, you can use the access token retrieved from the service account. Default access token is retrieved by ScriptApp.getOAuthToken(). You can see the detail information here https://github.com/tanaikech/CorporaApp
CorporaApp was updated to v1.0.1. v1.0.1 (February 16, 2024)
New method of searchQueryWithGenerateAnswer was added. You can see the detail information here https://github.com/tanaikech/CorporaApp
PDFApp was updated to v1.0.5. v1.0.5 (February 5, 2024)
A new method of “splitPDF” was added. Ref This method splits each page of a PDF to an individual PDF file. You can see the detail information here https://github.com/tanaikech/PDFApp
PDFApp was updated to v1.0.4. v1.0.4 (February 5, 2024)
From this discussion, I changed the logic of copyPages. You can see the detail information here https://github.com/tanaikech/PDFApp
UtlApp was updated to v1.0.3. v1.0.3 (February 5, 2024)
Methods of addQueryParameters was updated. You can see the detail information here https://github.com/tanaikech/UtlApp
DocsServiceApp was updated to v1.2.2 v1.2.2 (January 30, 2024)
Remove a bug in ExcelApp. When the inserted image had no data, an error occurred. This issue was removed. You can see the detail information here https://github.com/tanaikech/DocsServiceApp
UtlApp was updated to v1.0.2. v1.0.2 (January 25, 2024)
2 methods of dotProduct and cosineSimilarity were added. You can see the detail information here https://github.com/tanaikech/UtlApp
Overview This is a Google Apps Script library for using Microsoft Docs files (Word, Excel, and PowerPoint files) using Document service, Spreadsheet service, and Slides Service of Google Apps Script.
Description Recently, Microsoft Docs files (Word, Excel, and PowerPoint files) could be manually edited by opening it on Google Drive using the browser. This is good news for a lot of users. With this situation, the URLs of Microsoft Docs files were changed.
PDFApp was updated to v1.0.3. v1.0.3 (November 26, 2023)
From this discussion, I changed the logic of the method mergePDFs. The method for using mergePDFs and the output are not changed. With this modification, the large PDF data can be merged. You can see the detail information here https://github.com/tanaikech/PDFApp
HtmlFormApp was updated to v1.0.2. v1.0.2 (October 17, 2023)
The 2nd argument row of appendFormData(object, row) was added. This is from this suggestion. When row is used, the value is put into the specific row of the Spreadsheet. In this case, please set the value of row more than 1.
In this case, the submitted row can be forcefully put into the specific row of Google Spreadsheet.
go-gettokenbyserviceaccount was updated to v1.0.1 v1.0.1 (October 12, 2023)
Updated README.md and updated the script. You can get this from https://github.com/tanaikech/go-gettokenbyserviceaccount
Overview This is a Google Apps Script library for managing the histories of the Google Apps Script project.
Description On August 23, 2023, the project history has been implemented in the new IDE of Google Apps Script. Ref and Ref In the current stage, the users can see the history of the previously deployed script version. This is a very important implementation for a lot of developers.
Here, I remember the classic IDE.
PDFApp was updated to v1.0.2. v1.0.2 (August 21, 2023)
A new method of insertHeaderFooter was added. Ref When this method is used, the custom header and footer can be added when a Google Spreadsheet is exported as PDF. You can see the detail information here https://github.com/tanaikech/PDFApp
PDFApp was updated to v1.0.1. v1.0.1 (August 18, 2023)
About the method of “getMetadata”, pageInfo is added to the retrieved metadata. By this, each page size can be obtained. You can see the detail information here https://github.com/tanaikech/PDFApp
TriggerApp was updated to v1.0.1. v1.0.1 (August 18, 2023)
When toDay is not used, there was a case that the next trigger is not installed. This bug was removed. You can see the detail information here https://github.com/tanaikech/TriggerApp
Overview This is a Google Apps Script library for managing PDFs.
Description Google Apps Script is one of the most powerful tools for cloud computing. When Google Apps Script is used, the result can be obtained even when the user doesn’t stay in front of the PC and mobile phone by the triggers. One day, there might be a case where it is required to manage PDF data using Google Apps Script.
v1.2.2 (July 27, 2023)
Checked the array of to, cc, and bcc for the sendEmails method.
GitHub of OnedriveApp
v1.2.1 (July 26, 2023)
A bug of “Send Email messages” was removed.
GitHub of OnedriveApp
Overview This is a Google Apps Script library for efficiently managing the time-driven triggers for executing Google Apps Script using Google Apps Script.
Description Google Apps Script can execute with not only the manual operation but also several triggers. The time-driven trigger is one of them, and this is one of a lot of important functions. When the time-driven trigger is used, Google Apps Script can be automatically executed at the time you set without launching the user’s PC.
Overview This is a Google Apps Script library for easily managing the template of Google Documents and Google Slides using Google Spreadsheet as a database using Google Apps Script.
Description You might have situations where are required to create multiple Google Documents and Google Slides from the templates using Google Spreadsheet as a database with Google Apps Script. When the simple texts are replaced with the placeholders on the templates, this can be achieved by a simple script.
HtmlFormApp was updated to v1.0.1. v1.0.1 (May 29, 2023)
When multiple files are uploaded, each URL was set as the hyperlink. You can see the detail information here https://github.com/tanaikech/HtmlFormApp
Overview This is a Google Apps Script library including useful scripts for supporting to development of applications by Google Apps Script. In the current stage, the 3 categories “For array processing”, “For binary processing”, and “For string processing” are included in this library.
Description When I create applications using Google Apps Script, there are useful scripts for often use. At that time, I thought that when those scripts can be simply used, they will be useful not only to me but also to other users.
Overview This is a GAS library for supporting editing RichText in Google Spreadsheet using Google Apps Script.
Description There is RichTextApp in my published libraries. RichTextApp can be used mainly for converting RichText to Google Documents and vice versa. This library RichTextAssistant will support editing the rich text in Google Spreadsheets using Google Apps Script. Google Spreadsheet can use rich text as the cell value using Google Apps Script. But, I thought that when I created a script for editing the existing rich text in the cell, it might be a bit complicated.
BatchRequest was updated to v1.2.1. v1.2.1 (March 8, 2023)
An option of exportDataAsBlob was added to the request object to the method of EDo(). Ref When this option is used, the response values from the batch requests are returned as Blob. By this, for example, when you export Google Spreadsheet as PDF data using the batch requests, the PDF data can be retrieved as Blob. Sample script using exportDataAsBlob In this sample, the Spreadsheet and Document files are exported as PDF format using the batch requests.
BatchRequest was updated to v1.2.0. v1.2.0 (September 30, 2022)
A new method of getBatchPath(name, version) was added. After August 12, 2020, in order to use batch requests, the batch path is required to be used to the endpoint of the batch requests. And, the batch path is sometimes updated. So, when a constant batch path has been continued to be used, this might lead to the reason for an error.
Overview This is a Google Apps Script library for supporting Document service, Docs API, Spreadsheet service, Sheets API, Slides service and Slides API. The aim of this library is to compensate the processes that they services cannot achieve.
DocsServiceApp was updated to v1.2.0 v1.2.0 (September 29, 2022)
Added a new method of getNamedFunctions(). This method can retrieve the named functions from Google Spreadsheet. You can see the detail information here https://github.
Overview This is a Google Apps Script library for supporting Document service, Docs API, Spreadsheet service, Sheets API, Slides service and Slides API. The aim of this library is to compensate the processes that they services cannot achieve.
DocsServiceApp was updated to v1.1.0 v1.1.0 (September 28, 2022)
Added a new method of getQuotePrefixCells(). This method can detect the cells with the quote prefix cells. You can see the detail information here https://github.
Gists
This is a sample script for efficiently creating Web Apps using a Google Apps Script library.
When a Google Apps Script library is used for creating Web Apps, the following advantage can be obtained.
The script of the client-side can be simpler. Because most scripts for constructing Web Apps are included in the Google Apps Script library. When the script of Web Apps (In this case, the script of Google Apps Script library is modified.
Javascript Library for Cropping Image by Border Overview This is a Javascript library for cropping images by the border.
Description When an image is used, there is a case where I wanted to simply crop the image by a script. In this Javascript library, the image is cropped by a border. The sample situation is as follows.
In this sample situation, a red rectangle is enclosed by a border (1 pixel) with “#000000”.
RichTextApp was updated to v1.4.0 v1.4.0 (May 25, 2022)
Added a new method of ReplaceTextToRichText. In this method, the text in a cell is converted to the richtext. You can see the detail information here https://github.com/tanaikech/RichTextApp
Overview This is a Google Apps Script library for managing the named range on Google Documents.
Description Google Document can use the named range. When the named range is used, the users can directly access the contents using the named range. For example, the developer can guide the users to the specific content in Google Documents using the named range. But, unfortunately, in the current stage, it seems that the named range cannot be directly used by the UI on Google Documents.
getcode was updated to v1.0.1 v1.0.1 (February 26, 2022)
Latest libraries are reflected to this library. And, the sample script is shown using the Quickstart for go of Drive API. You can get this from https://github.com/tanaikech/getcode
go-getfilelist was updated to v2.0.0 v2.0.0 (February 25, 2022)
By changing the specification of methods, drive.New() and transport.APIKey were deprecated. By this, I updated the specification of this library as the version 2. When you are required to continue to use drive.New() and transport.APIKey, you can use them with the version 1. At version 1, *http.Client is given to this library. From version 2, *drive.Service is given instead of *http.
RichTextApp was updated to v1.3.1 v1.3.1 (February 8, 2022)
Modified the method of DocumentToSpreadsheet. Before this update, the paragraphs with only line breaks have been ignored. From this version, such paragraphs are included in the result value of the cell. You can see the detail information here https://github.com/tanaikech/RichTextApp
Today, I noticed that the sheet ID of Spreadsheet, which is one of database, had been changed. So I used the sheet name of “Libraries” instead of the sheet ID. By this, the Google Apps Script library can be retrieved from 2 databases.
Google Apps Script Library Database
Overview This is a Google Apps Script library for parsing the form object from HTML form and appending the submitted values to the Spreadsheet.
Description There is Google Form in the Google service. Google Form can parse the submitted data and put it in the Spreadsheet. But when we want to use the custom form, it is required to use the HTML form on Web Apps, dialog, and sidebar. In this case, it is required to prepare Javascript and Google Apps Script for parsing the form object from the HTML form and appending the parsed values to Spreadsheet.
This is a Javascript library for sending the HTML form object to Google Apps Script using google.script.run.
HtmlFormObjectParserForGoogleAppsScript_js was updated to v1.0.1.
v1.0.1 (January 11, 2022)
A new argument of includeOrder was added as the 4th argument. This library returns the parsed form object as a JSON object. By this, the order of HTML form object is not saved. From this version, this order can be included. This argument includes the order of each input tag in form.
ResumableUploadForGoogleDrive_js was updated to v2.0.0.
v2.0.0 (November 15, 2021)
New Class ResumableUploadToGoogleDrive2 was added. By this, the large file which is over the memory in the local PC can be uploaded by the resumable upload. Overview This is a Javascript library to achieve the resumable upload for Google Drive.
Description When a file more than 5 MB is uploaded to Google Drive with Drive API, the resumable upload is required to be used.
RichTextApp was updated to v1.3.0 v1.3.0 (October 20, 2021)
Added a new method of RangeToHTMLTableForSpreadsheet. In this method, the range on Google Spreadsheet is converted to a HTML table. Using this method, for example, you can send the specific range in the Spreadsheet as an email by including a HTML table. You can see the sample HTML table at https://jsfiddle.net/oq9x458e/. I used this method for this thread of Stackoverflow.
Gists
This is a sample script for sending Outlook emails using Microsoft account with Google Apps Script.
Before you use this script, please install OnedriveApp which is Google Apps Script library. Ref And, please authorize your Microsoft account for using Microsoft Graph API. Ref
Sample script function myFunction() { const obj = [ { to: [{ name: "### name ###", email: "### email address ###" }, , ,], subject: "sample subject 1", body: "sample text body", cc: [{ name: "name1", email: "emailaddress1" }, , ,], }, { to: [{ name: "### name ###", email: "### email address ###" }, , ,], subject: "sample subject 2", htmlBody: "<u><b>sample html body</b></u>", attachments: [blob], bcc: [{ name: "name1", email: "emailaddress1" }, , ,], }, ]; const prop = PropertiesService.
Gists
This is a sample script for retrieving the list of all emails of Microsoft account and putting them to Google Spreadsheet using Google Apps Script.
I updated OnedriveApp to v1.2.0 by adding 1 method for retrieving the access token and 7 methods for managing emails of Microsoft account. By this, the emails got to be able to be gotten and sent using Microsoft account using OnedriveApp with Google Apps Script.
OnedriveApp was updated to v1.2.0.
v1.2.0 (October 4, 2021)
1 method for retrieving the access token and 7 methods for managing emails of Microsoft account were added. By this, the emails got to be able to be gotten and sent using Microsoft account using OnedriveApp with Google Apps Script.
GitHub of OnedriveApp
OnedriveApp was updated to v1.1.2.
v1.1.2 (September 29, 2021)
A bug of method of uploadFile was removed. By this, the files except for Google Docs files can be uploaded to OneDrive.
GitHub of OnedriveApp
Overview This is a Javascript library to retrieve the access token from the Google Service Account. Ref
Description I have already posted the sample script for retrieving the access token from the Google Service Account. Ref But, when I use this script, I thought that when this was published as the Javascript library, it will be useful. So I created this.
Install <script src="getaccesstokengromserviceaccount_js.min.js"></script> Or, using jsdelivr cdn
<script src="https://cdn.jsdelivr.net/gh/tanaikech/GetAccessTokenFromServiceAccount_js@master/getaccesstokengromserviceaccount_js.min.js"></script> You can see the detail of this at https://github.
Parser for Sending HTML Form Object to Google Apps Script using google.script.run Overview This is a Javascript library for sending the HTML form object to Google Apps Script using google.script.run.
Description HTML form object is parsed by this library, and the object can be sent to Google Apps Script using google.script.run. After the V8 runtime got to be able to be used for Google Apps Script, when the file input tag is included in the HTML form object, the object sent to Google Apps Script using google.
BatchRequest was updated to v1.1.3. v1.1.3 (January 13, 2021)
In order to give the access token from outside, the access token got to be able to be included in the object. By this, for example, you can use the access token retrieved by the service account. You can check this at https://github.com/tanaikech/BatchRequest.
Overview This is a library for running Batch Requests for Google APIs using Javascript.
Description When users use Google’s APIs, one quota is used for one API call. When the batch request is used, several APIs can be called by one quota, although there are some limitations in the batch request.
google-api-javascript-client can run the batch request. Ref But, I created this for my self study. This library can achieve the batch request using fetch without using google-api-javascript-client.
FilesApp was updated to v1.1.3.
v1.1.3 (December 12, 2020)
Access token got to be able to be given as an argument. When the access token is not given as the argument, ScriptApp.getOAuthToken() is used as the default access token. By this, the service account can be used. GitHub of FilesApp
ImgApp was updated to v1.3.0.
v1.3.0 (September 24, 2020) Added new method. Added editImage() This method is for editing images. In the current stage, the image can be cropped. And several images can be merged as an image. You can see the detail information here https://github.com/tanaikech/ImgApp
Overview This is a Google Apps Script library for supporting Document service, Docs API, Spreadsheet service, Sheets API, Slides service and Slides API. The aim of this library is to compensate the processes that they services cannot achieve.
Description The Google services, which are Document service, Docs API, Spreadsheet service, Sheets API, Slides service and Slides API, are growing now. But, unfortunately, there are still the processes that they cannot done.
FetchApp was updated to v1.0.2. v1.0.2 (September 19, 2020)
From this version, when a blob is sent, the blob is sent to files. You can check this at https://github.com/tanaikech/FetchApp.
python library - getfilelistpy was updated to v1.0.7. v1.0.7 (August 11, 2020)
Pull request was reflected. You can check getfilelistpy at https://github.com/tanaikech/getfilelistpy.
You can also check getfilelistpy at https://pypi.org/project/getfilelistpy/.
v1.0.3 (August 1, 2020)
When the file size less than the default chunk is downloaded, an error occurred. This bug was removed. You can see the detail information here https://github.com/tanaikech/DownloadLargeFilesByUrl
Overview This is a Google Apps Script library for creating, updating and exporting Google Apps Script project of the standalone type using Drive API. In this case, Apps Script API is not used.
Description I had reported “Drive API cannot create Google Apps Script project no longer” before. Ref About this, I had reported the future request. Ref At July 30, 2020, I could confirm that the Google Apps Script project of the standalone type got to be able to be created by multipart/form-data using Drive API again.
Overview This is a Google Apps Script library for achieving the ownership-transfer of the specific folder including the files and sub-folders using Drive API.
IMPORTANT: PLEASE BE CAREFUL THIS. At first, please read this section I cannot take responsibility for the problems occurred by this library. So when you use this library, please use it by according to your own decision and at your own responsibility. This GAS library transfers the ownership of files and folders.
RichTextApp was updated to v1.2.0 v1.2.0 (July 3, 2020)
Added the method of AutoResizeFontForSpreadsheet. This method can automatically adjust the text length to fit in the cell width by changing the font size. You can see the detail information here https://github.com/tanaikech/RichTextApp
RichTextApp was updated to v1.1.3 v1.1.3 (June 17, 2020)
The variable name for the error processing was not correct. The bug was removed. Added a sample script for using this library. You can see the detail information here https://github.com/tanaikech/RichTextApp
RichTextApp was updated to v1.1.2 v1.1.0 (June 16, 2020)
Add new method of RichTextToHTMLForSpreadsheet. The method of RichTextToHTMLForSpreadsheet can convert the rich texts in the cells to the HTML format. v1.1.1 (June 16, 2020)
About the method of RichTextToHTMLForSpreadsheet, I forgot to convert hyperlinks to HTML. This was modified. v1.1.2 (June 16, 2020)
When one row and several columns are used as the range, only 1st column is returned.
BatchRequest was updated to v1.1.2. v1.1.1 (June 12, 2020)
Error handling for the input object was added. v1.1.2 (June 12, 2020)
Removed a bug that when the returned value is empty, an error occurred. You can check this at https://github.com/tanaikech/BatchRequest.
BatchRequest was updated to v1.1.0. v1.1.0 (June 10, 2020)
New method of EDo() was added. This method is the enhanced Do() method. When this method is used, the result values from the batch requests are parsed. And also, the number of requests more than 100 can be used. In this case, the split of the number of requests is processed for the limitation of 100. You can check this at https://github.
RunAll was updated to v1.1.2. v1.1.2 (May 31, 2020)
When the access token and project ID are not included in the object, getOAuthToken() and getScriptId(). By this, an error is removed. You can see the detail information here https://github.com/tanaikech/RunAll
FilesApp was updated to v1.1.2.
v1.1.2 (May 29, 2020)
A bug that all files were not retrieved from the shared drive was removed. GitHub of FilesApp
Overview This is Google Apps Script library for copying folder on Google Drive.
Description I have sometimes the situation that it is required to back up the folder on Google Drive to Google Drive. But unfortunately, the method of makeCopy() of Class File and the method of Files: copy of Drive API cannot be used for directly copying the folder on Google Drive. So I created this as a library. This library can copy the folder on Google Drive.
GetFileList_js was updated to v1.0.2. v1.0.2 (May 15, 2020)
Shared drive got to be able to be used. The file list can be retrieved from both your Google Drive and the shared drive.
For example, when the folder ID in the shared Drive is used id of resource, you can retrieve the file list from the folder in the shared Drive. You can see the detail information here https://github.
python library - getfilelistpy was updated to v1.0.5. v1.0.5 (May 15, 2020)
Shared drive got to be able to be used. The file list can be retrieved from both your Google Drive and the shared drive.
For example, when the folder ID in the shared Drive is used id of resource, you can retrieve the file list from the folder in the shared Drive. You can check getfilelistpy at https://github.
go-getfilelist was updated to v1.0.3 v1.0.3 (May 14, 2020)
Shared drive got to be able to be used. The file list can be retrieved from both your Google Drive and the shared drive.
For example, when the folder ID in the shared Drive is used folderID of Folder(folderID), you can retrieve the file list from the folder in the shared Drive. You can get this from https://github.
FilesApp was updated to v1.1.0.
Shared drive got to be able to be used. From the version 1.1.0, the following modification was added. V8 is used. As the default setting, the file list is retrieved from both your Google Drive and the shared drive. By this, for example, when the folder ID in the shared Drive is used to ### of const res = FilesApp.createTree("###"), the folder tree of the shared Drive is retrieved, if you have the shared Drive.
FetchApp was updated to v1.0.1. v1.0.1 (April 13, 2020)
When V8 runtime is enabled, it was found that an error occurred. So this bug was removed. You can check this at https://github.com/tanaikech/FetchApp.
Web Application for searching Google Apps Script Library from Database was completed. So I published it as v1.0.0. Please check Google Apps Script Library Database.
Overview This is a GAS library for retrieving and creating the albums and media items using Google Photo API using Google Apps Script (GAS).
Description In the current stage, Google Photo API is not included in Advanced Google services. But in order to use Google Photo API with Google Apps Script, I created this as a GAS library. So in the current stage, in order to use this library, the following flow is required.
Overview This is a GAS library for copying the rich text with the text styles from Google Document to Google Spreadsheet or from Google Spreadsheet to Google Document using Google Apps Script (GAS).
Description Google Spreadsheet can use the rich text as the cell value. But I thought that it is difficult for me to directly edit the rich text in a cell. So I wanted to copy the rich text, that I edited at the Google Document, to the cell of Google Spreadsheet.
Overview This is for the Google Apps Script Library Database.
Description Since Google Apps Script was released on August 19th, 2009, it is used by a lot of users. Ref1, Ref2 By this, now there are a lot of useful libraries of Google Apps Script (GAS) in all over the world. But when I want to search a GAS library, I always use Google search engine. Unfortunately, in the current stage, the libraries cannot be directly searched by a database.
ManifestsApp was updated to v1.0.4.
v1.0.4 (February 12, 2020)
“runtimeVersion” got to be able to be got and set. Now, ‘STABLE’, ‘V8’, ‘DEPRECATED_ES5’ can be used as the value of “runtimeVersion”. For example, you can enable V8 with the following script.
var r = ManifestsApp.setProjectId(projectId).setRuntimeVersion("V8"); Logger.log(r); As one important point, when “STABLE” and “DEPRECATED_ES5” are used for the Google Apps Script project created before 2020 as the value of “runtimeVersion”, the error of Syntax error: Illegal character.
Overview DateFinder is a GAS library for searching the date objects from the cell range on the sheet in the Spreadsheet and retrieving the searched range as the RangeList object using Google Apps Script (GAS).
Description There is the Class TextFinder for searching the text from cells of the Spreadsheet using the Google Apps Script. But in this case, the date object in the cell is used as the string. Namely, the values for searching are used as the same with the values retrieved by getDisplayValues().
Overview EncodeApp is a GAS library for retrieving the encoding set (charset) and doing URL encode with the specific encoding set using Google Apps Script (GAS).
You can see the detail information here https://github.com/tanaikech/EncodeApp
Libraries of gdoctableapp for golang, Node.js and python were updated to v1.1.0 go-gdoctableapp
v1.1.0 (January 22, 2020) 2 new methods were added. From this version, the texts can be replaced by images. The direct link and local file can be used as the image. node-gdoctableapp
v1.1.0 (January 22, 2020) New method was added. From this version, the texts can be replaced by images.
Libraries of gdoctableapp for golang, Node.js and python were updated to v1.0.5 go-gdoctableapp node-gdoctableapp gdoctableapppy Update History v1.0.5 (January 21, 2020)
When the inline objects and tables are put in the table. An error occurred. This bug was removed by this update. I got the pull request at here.
GmailToList was updated to v1.0.1. v1.0.1 (December 17, 2019)
New method of getAttachmentFiles() was added. The attachment files can be retrieved as blob using this method. You can see the detail information here https://github.com/tanaikech/GmailToList
Overview This is a library for exporting all messages of Gmail as a list using Google Apps Script (GAS).
Description Recently, I have had a situation it had been required to backup all messages in own Gmail. In order to achieve this, I created a simple script. After I created it, I thought that when such situation might occur for other users and the script is published as a library, they might be useful.
GetEditType was updated to v1.0.1. v1.0.1 (October 25, 2019)
Updated: This answer was reflected. You can see the detail information here https://github.com/tanaikech/GetEditType
ZipFolder was updated to v1.0.1. v1.0.1 (October 15, 2019)
The option for preventing the duplicated filenames when the Google Docs is converted was added. You can see the detail information here https://github.com/tanaikech/ZipFolder
Overview This is a Javascript library to achieve the resumable upload for Google Drive.
Description When a file more than 5 MB is uploaded to Google Drive with Drive API, the resumable upload is required to be used. I have already published the sample script for “Resumable Upload for Web Apps using Google Apps Script”. Ref In this case, Web Apps is used. Here, I would like to introduce the script for the resumable upload created by only Javascript.
GetFileList_js was updated to v1.0.1. v1.0.1 (September 30, 2019)
A bug related to the scope of variables was removed. You can see the detail information here https://github.com/tanaikech/GetFileList_js
RunAll was updated to v1.1.1. v1.1.1 (September 20, 2019)
When the number of 0 was used as the argument, null was returned. This bug was removed. Coffeescript as the source was updated. You can see the detail information here https://github.com/tanaikech/RunAll
Overview This is a Javascript library to use “google.script.run” with the synchronous process.
Description When I create Web Apps, add-on using a side bar and dialog, there is the case that I want to use google.script.run with the synchronous process. As you know, google.script.run works with the asynchronous process. So in order to use it as the synchronous process, the script is required to be prepared. I also saw several issues for such situation at Stackoverflow and other sites.
Overview This is a Javascript library to retrieve the file list with the folder tree from the specific folder (publicly shared folders and own folders) of Google Drive.
Description The library for retrieving the file list with the folder tree from the specific folder of Google Drive has already been published for Google Apps Script, golang, node.js and python as GetFileList. Ref Here, this GetFileList was released as the library of Javascript.
RunAll was updated to v1.1.0. v1.1.0 (August 26, 2019)
New method for achieving the parallel processing with Web Apps was added. You can see the detail information here https://github.com/tanaikech/RunAll
python library - getfilelistpy was updated to v1.0.4. v1.0.4 (August 23, 2019)
For OAuth2, oauth2client and google_auth_oauthlib got to be able to be used. About the sample script for google_auth_oauthlib, please see this. You can check getfilelistpy at https://github.com/tanaikech/getfilelistpy.
You can also check getfilelistpy at https://pypi.org/project/getfilelistpy/.
Overview This is a GAS library for unzipping a Zip file protected by a password using Google Apps Script.
Description Recently, I had a situation that it is required to unzip a Zip file protected with the password. But unfortunately, in the current stage, the method of Utilities.unzip() cannot unzip such protected files. So when I had been looking for the other workarounds, I found zlib.js. Especially, it’s unzip.min.js. This is created for Javascript.
Overview This is a python library to manage the tables on Google Document using Google Docs API.
Description Google Docs API has been released. When I used this API, I found that it is very difficult for me to manage the tables on Google Document using Google Docs API. Although I checked the official document, unfortunately, I thought that it’s very difficult for me. So in order to easily manage the tables on Google Document, I created this library.
Overview This is a Golang library for managing tables on Google Document using Google Docs API.
Description Google Docs API has been released. When I used this API, I found that it is very difficult for me to manage the tables on Google Document using Google Docs API. Although I checked the official document, unfortunately, I thought that it’s very difficult for me. So in order to easily manage the tables on Google Document, I created this library.
Overview GetEditType is a GAS library for retrieving the edit types of the OnEdit event trigger of Spreadsheet using Google Apps Script (GAS).
Description In the case that the OnEdit event trigger (simple and installable triggers) is used at Spreadsheet, when users manually edited the cell of Spreadsheet, the trigger is fired. At this time, there is the case that I want to know the edit type. For example, I would like to know about the following edit types.
Overview This is a Golang library for running HTTP requests with the asynchronous process. The progress of requests can be also shown.
Demo In this demonstration, 5 requests are run by 2 workers. And before each request, the waiting time for 2 seconds is added as a sample. By this, you can easily see the work with 2 workers. Also you can see this script at the following sample script.
Overview This is a GAS library for creating and requesting the type of multipart/form-data using Google Apps Script. This library enhances Class UelFetchApp of Google Apps Script.
Description In order to fetch data from URL, there is Class UrlFetchApp in Google Apps Script. As the method for fetching, there is the method of fetch(url, params). In the current stage which was released this library, when user want to request with the type of multipart/form-data, the request body is required to be created by the user.
ImgApp was updated to v1.2.2.
v1.2.2 (April 6, 2019)
By Google’s update, the error of “Malformed multipart body.” occurs. This error was resolved.
You can see the detail information here https://github.com/tanaikech/ImgApp
Overview This is a GAS library for notifying the change of number of comments, stars and forks of own Gists as an email using Google Apps Script.
Description Recently, I noticed that when a comment was posted to own Gists, and the numbers of stars and forks of own Gists were changed, the notification mail is not sent. Also I knew that in the current stage, there are no official methods for notifying them, yet.
ProcessApp was updated to v1.0.1.
v1.0.1 (February 10, 2019)
New method of getExecutionTimeOfProcessType() was added. This method retrieves the total execution time of all functions by filtering the process type. For example, the total execution time of Web Apps can be retrieved. You can see the detail information here https://github.com/tanaikech/ProcessApp
Overview This is a library for retrieving the process and information of Google Apps Script.
Methods getExecutionTimeOfTrigger() : This method retrieves the total execution time of all functions executed by the time-driven trigger at owner’s account. For example, you can know the total execution time of all functions executed by the time-driven trigger in 24 h. getDevUrl() : This method retrieves the endpoint of developer mode for Web Apps like https://script.
go-getfilelist was updated to v1.0.2 v1.0.2 (December 12, 2018)
New method for selecting mimeType was added. When this method is used, files with the specific mimeType in the specific folder can be retrieved. You can get this from https://github.com/tanaikech/go-getfilelist
Overview This is a Golang library to retrieve access token from Service Account of Google without using Google’s OAuth2 package.
You can get this from https://github.com/tanaikech/go-gettokenbyserviceaccount
v1.0.1 (December 5, 2018)
When the filename have not been retrieved, an error have occurred. This bug was removed. You can see the detail information here https://github.com/tanaikech/DownloadLargeFilesByUrl
Gists
When I create applications for using Google Drive, I often retrieve a file list from a folder in the application. So far, I had created the script for retrieving a file list from a folder for each application. Recently, I thought that if there is the script for retrieving the file list with the folder tree from the folder of Google Drive as a library, it will be useful for me and other users.
Overview This is a python library to retrieve the file list with the folder tree from the specific folder of Google Drive.
Description When I create applications for using Google Drive, I often retrieve a file list from a folder in the application. So far, I had created the script for retrieving a file list from a folder for each application. Recently, I thought that if there is the script for retrieving the file list with the folder tree from the folder of Google Drive as a library, it will be useful for me and other users.
go-getfilelist was updated to v1.0.1 v1.0.1 (November 13, 2018)
From this version, in order to retrieve files and file information, “google.golang.org/api/drive/v3” is used. By this, when the values are retrieved from this library, users can use the structure of drive.File. Script using this library can be seen at goodls. You can get this from https://github.com/tanaikech/go-getfilelist
ImgApp was updated to v1.2.1.
v1.2.1 (November 5, 2018)
Efficiency of each loop was enhanced by this benchmark.
You can see the detail information here https://github.com/tanaikech/ImgApp
Overview This is a Golang library to retrieve the file list with the folder tree from the specific folder of Google Drive.
Description When I create applications for using Google Drive, I often retrieve a file list from a folder in the application. So far, I had created the script for retrieving a file list from a folder for each application. Recently, I thought that if there is the script for retrieving the file list with the folder tree from the folder of Google Drive as a library, it will be useful for me and other users.
Overview ArrangeStackingOrder is a GAS library for arranging the stacking order of page elements on Google Slides using Google Apps Script (GAS).
Demo This is a demonstration of this library when this is used as a Google Slides Addon.
Description Do you have situations that you want to arrange the stacking order of page elements on Google Slides using GAS? I had it before. At that time, I could achieve it by creating a simple script.
RangeListApp was updated to v1.0.1.
v1.0.1 (September 13, 2018)
New method of “expandA1Notations” was added. This method can expand the a1Notations. For example, A1:C2 is expanded to "A1","B1","C1","A2","B2","C2". You can check this at https://github.
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.
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.
ManifestsApp was updated to v1.0.3.
v1.0.3 (July 11, 2018)
By Google’s update, “sheets” was added to manifests for installing the configuration of Macro. By this, this library was updated. You can see the added methods (getSheets(), setSheets()) at Usage. If you set “sheets”, please put the value of “sheets” as the resource like below sample. {"macros": [{"menuName": "QuickRowSum", "functionName": "calculateRowSum"}]} Don’t put {"sheets": {"macros": [{"menuName": "QuickRowSum", "functionName": "calculateRowSum"}]}} You can check this at https://github.
Overview FilesApp is a GAS library for retrieving file and folder list in Google Drive using Google Apps Script (GAS). Also this can create a tree from all files and folders in Google Drive.
Description When I create some applications using Google Drive, there are often the case which is required to retrieve the file list and folder list. I had prepared the script each time for each case so far.
Overview This is a library for running Batch Requests using Google Apps Script (GAS).
Description When users use Google’s APIs, one quota is used for one API call. When the batch request is used, several APIs can be called by one quota, although there are some limitations in the batch request. For example, in GAS, Drive API can be used be DriveApp. In this case, the quota is not used for using Drive API.
Overview This is a library for running the concurrent processing using only native Google Apps Script (GAS).
Description Have you ever thought about the concurrent processing using only native Google Apps Script (GAS)? So far, I had run the concurrent processing using golang, javascript and python. But the script cannot be used by the trigger event, because these are not native GAS. Recently, it was found that the fetchAll method added by the Google’s update at January 19, 2018 is worked by the asynchronous processing.
ManifestsApp was updated to v1.0.2.
v1.0.2 (January 29, 2018)
ProjectApp2 is published, and got to be able to use both standalone script type and container-bound script type. By this, this library also got to be able to be used for the both projects. For this update, please enable Apps Script API. Please check “How to install”. You can check this at https://github.
Overview This is a GAS project library for Google Apps Script (GAS). This library can be used for the projects of both standalone script type and container-bound script type.
Description There are Class SpreadsheetApp and Class DocumentApp for operating spreadsheet and document, respectively. But there is no Class for operating GAS project. If there is such Class ProjectApp, GAS project can be directly operated by GAS script. I thought that this will lead to new applications, and created ProjectApp.
Gists
Introduction By recent Google update (Google update at October 24, 2017), various new winds to GAS developers were blown. There is “Manifests” as one of the new winds. “Manifests” makes us manage the project using JSON. Especially, the special scopes which have to use OAuth2 process can be used by only setting them to the Manifests. I think that this is the largest modification. However, when scopes are added to a project using Manifests, users who use the project can use only added scopes.
Overview This is a GAS application for rearranging Google Apps Scripts (GAS) in a project which can be seen at the script editor.
Description Have you ever thought about rearranging Google Apps Scripts in a project which can be seen at the script editor? I also have thought about it. Finally, I could find the workaround to do it. And recently, I have given this function to ggsrun which is a CLI tool.
Overview This is a library for zipping a folder using Google Apps Scripts.
Description When users manually download a folder on Google Drive, users can download all files in the folder as a zip file using the web interface. There are zip tools in Class Utilities of Google Apps Script. However, the zip tools cannot create a zip file from a folder. And it cannot retrieve all files included any folders in a folder.
Overview This is a Manifests library for Google Apps Scripts.
Description By recent update of Google, Manifests was added to Google Apps Script Project. At the moment I saw the detail, I thought that this Manifests will blow a new wind for a lot of GAS developers. So I created this.
This library makes users easily access Manifests using Google Apps Script. If this was useful for you, I’m glad.
Overview This is a GAS project library for Google Apps Script (GAS).
Description There are Class SpreadsheetApp and Class DocumentApp for operating spreadsheet and document, respectively. But there is no Class for operating GAS project. If there is the Class ProjectApp, GAS project can be directly operated by GAS script. I thought that this will lead to new applications, and created ProjectApp.
On the other hand, as a CLI tool for operating GAS project, there has already been ggsrun.
OnedriveApp was updated to v1.1.0.
From this version, retrieving access token and refresh token became more easy.
GitHub of OnedriveApp
OnedriveApp was updated to v1.0.2.
Moved the instance of PropertiesService.getScriptProperties() to outside of this library. When there is the PropertiesService.getScriptProperties() inside the library, it was found that the parameters that users set was saved to the library. So this was modified. I’m sorry that I couldn’t notice this situation.
GitHub of OnedriveApp
OnedriveApp was updated to v1.0.1.
Added a method for retrieving access token and refresh token using this library.
By added this method, OneDrive APIs can be used by only this library.
GitHub of OnedriveApp
ImgApp was updated to v1.2.0. New method was added.
3. updateThumbnail() Overview This method is for updating thumbnail of files on Google Drive using images you selected.
Description For example, zip files don’t have the thumbnail on Google Drive. An icon is shown as the thumbnail. For the most files, Google Drive can create automatically each thumbnail. But there are sometimes files which cannot be created the thumbnail. Zip file is also one of them.
This is a library of Google Apps Script for using Microsoft OneDrive.
Feature This library can carry out following functions using OneDrive APIs.
Retrieve file list on OneDrive. Delete files and folders on OneDrive. Create folder on OneDrive. Download files from OneDrive to Google Drive. Upload files from Google Drive to OneDrive. Demo You can see the detail information here https://github.com/tanaikech/OnedriveApp
ImgApp was updated to v1.1.0. New method was added.
2. doResize() Overview This method is for resizing images.
Description Unfortunately, there are no methods to resize images at Google Apps Script. As a workaround, there is a method that it imports the image in Google Document and resizes the image using setWidth() and setHeight(). But in this method, the resized blob cannot be retrieved. So although I had thought of other workaround, I had not been able to find it.
1. getSize() Overview This method is for retrieving the width and height of image as the unit of pixel.
Description Unfortunately, there are no methods to directly retrieve the image size at Google Apps Script. As a workaround, there is a method that it imports the image in Google Document and retrieves the size using getWidth() and getHeight(). But in this method, it uses much time and resources on Google. So I thought of retrieving the information of image at the binary level, and created this.
Overview This is a Golang library to automatically get an authorization code for retrieving access token using OAuth2.
Description When it retrieves an access token and refresh token using OAuth2, the code for retrieving them has to be got by authorization on own browser. In order to retrieve the code, in generally, users have to click the authorization button and copy the code on the browser. This library can be automatically got the code by launching HTML server as a redirected server.
SOUWA means summing in Japanese. SOUWA can sum string elements in an array at the high speed. The speed of SOUWA with the pyramid algorithm is about 380 times faster than that of the standard method. New algorithm for summing array elements was developed for SOUWA. You can see the detailed report of this library at here. If you are interested in this, I’m glad.
It was updated to v1.0.2. Please check it out.
Recently, I had been looking for creating an image from coordinate data. Unfortunately I have never found them. So I made this. This Google Apps Script (GAS) library creates an image file from coordinate data.
You can see the detail information at https://github.com/tanaikech/CreateImg.
There is a part where I would like to improve in this library. That’s convByteSlice(). I think that there is the method to be faster about the part.
This “souwapy” is a library for summing array elements with high speed by new algorithm (Pyramid method). The speed is faster than csv and panbdas module of python and v8 engine of node.js. The souwapy module is 2.3 and 3.1 times faster than csv and pandas module, respectively. This was really surprised me. It was found that the theory was correct.
At first, I have created this theory for Google Apps Script.