You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Instantly share code, notes, and snippets.
Kanshi TANAIKE
tanaikech
Ph.D. in Physics / Google Developer Expert (GDE) / Google Cloud Champion Innovator
This is a sample script for retrieving a folder tree using Node.js. In this sample, you can set the top of folder for the folder tree. In generally, the folder tree is created by retrieving folders from the top folder in order. For example, when Google Apps Script is used, the script becomes like this. But when Drive API is used for this situation, if there are a lot of folders in the top folder, a lot of APIs are required to be called. So in this sample, I have tried to create the folder tree by a small number of API calls as possible.
In this sample, in order to be easy to understand the flow, I used Quickstart for Node.js. When you use this sample script, at first, please check the document of Quickstart. And I confirmed that this sample worked at googleapis v30.0.0.
When PDF file can be managed with Google Apps Script, that will lead to the automation process on cloud. In this report, the method for cooking PDF over Google Apps Script.
Benchmark: fetchAll method in UrlFetch service for Google Apps Script
Benchmark: fetchAll method in UrlFetch service for Google Apps Script
By Google's update at January 19, 2018, fetchAll method was added to the UrlFetch service. When I saw the usage, I couldn't find the detail information about the actual running state. So I investigated about it.
As the result, it was found that the fetchAll method is worked by the asynchronous processing. The returned data is reordered by the order of requests. By this, it was also found that if you want to retrieve the data from the several URL, the process cost of UrlFetchApp.fetchAll() is much lower than that of UrlFetchApp.fetch() using for loop.
The sample scripts for server side and client side are as follows.
Sample script for server side
In this report, 5 Web Apps were used as the servers. At first, 5 standalone projects were created and the following server script was put to each project. Then, Web Apps was deployed for ea
Downloading Shared Files on Google Drive Using Curl
Downloading Shared Files on Google Drive Using Curl
When the shared files on Google Drive is downloaded, it is necessary to change the download method by the file size. The boundary of file size when the method is changed is about 40MB.
Number of Requests for Sheets API using Google Apps Script
Number of Requests for Sheets API using Google Apps Script
This is a report for checking the number of requests for Sheets API. I had contact about the quota for Sheets API. So, in order to explain this, I used the following simple sample scripts.
Sample 1
This sample puts a value of "sample" to a cell "A1" using the batchUpdate method. This request body includes one request. When this script is run, one API quota is used.
Modifying Revisions of a File on Google Drive using Google Apps Script
Modifying Revisions of a File on Google Drive using Google Apps Script
This is a sample script for modifying the revisions of a file on Google Drive using Google Apps Script. This script can be used for not only Google Docs files, but also the files except for Google Docs.
Issue and workaround:
Unfortunately, in the current stage, at Google Docs files, the revision of Google Docs cannot be directly changed by APIs with a script. So as one of several workarounds, I would like to propose to overwrite the Google Docs file using the exported data. On the other hand, at the files except for Google Docs, the data can be directly retrieved with the revision ID. This can be used for overwriting the file. The flow of this script is as follows.
Consolidate Scattered A1Notations into Continuous Ranges on Google Spreadsheet using Google Apps Script
Consolidate Scattered A1Notations into Continuous Ranges on Google Spreadsheet using Google Apps Script
Abstract
Consolidate scattered cell references (A1Notation) in Google Sheets for efficiency. This script helps select cells by background color or update values/formats, overcoming limitations of large range lists.
Uploading Local Files to Google Drive without Authorization using HTML Form
Uploading Local Files to Google Drive without Authorization using HTML Form
This is a sample script for uploading local file to Google Drive without the authorization using HTML form. A selected file in your local PC using HTML form is uploaded to Google Drive and saved to Google Drive.
When you use this, at first, please deploy Web Apps. The script is doPost() of following scripts.
Parsing Invoices using Gemini 1.5 API with Google Apps Script
Parsing Invoices using Gemini 1.5 API with Google Apps Script
Abstract
This report explores using Gemini, a new AI model, to parse invoices in Gmail attachments. Traditional text searching proved unreliable due to invoice format variations. Gemini's capabilities can potentially overcome this inconsistency and improve invoice data extraction.