Gist
This is a sample script for retrieving images on Spreadsheet.
Unfortunately, there are no methods for retrieving directly images on spreadsheet using GAS. So I use the method which retrieves URL from =image(URL) and retrieves the image from the URL.
In this case, =image(URL) has to be in the cell. Images embedded by insertImage() cannot be retrieved.
At first, please confirm them.
Sample script : var cell = "A1"; // Cell address with the function of "=image()" var filename = "samplename"; // Output filename var image = SpreadsheetApp.
This sample is for retrieving array coordinates of duplicated elements.
Script : var inputdata = ["a", "b", "b", "c", "d", "c", "e", "a", "f", "g"]; var dic = {}; var result = []; inputdata.forEach(function(e, i){ if (dic[e]) { result[i] = 'Duplicated'; } else { result[i] = null; } dic[e] = "temp"; }); Logger.log(JSON.stringify(result)) Logger.log([i for (i in result) if(result[i]=='Duplicated')]) Result : [null,null,"Duplicated",null,null,"Duplicated",null,"Duplicated",null,null] [2, 5, 7]
Gists
This is a sample of Google Apps Script. This script is for retrieving all files and folders under a folder on Google Drive. All files and folders in the specific folder can be retrieved.
If you want to retrieve file list with all files and folders on Google Drive, please use DriveApp.getRootFolder().getId() as folderId.
When there are a lot of files in the folder, it may be over the limitation time to execute script.
ggsrun was updated to v.1.2.2 For Google Docs (spreadsheet, document, slide and drawing), since I noticed that the revision files would not be able to be retrieved using Drive API v3, I modified this using new workaround. The new workaround is to use Drive API v2. drive.revisions.get of Drive API v2 can retrieve not only the revision list, but also the export links. I thought of the use of the export links.
This method was updated at July 12, 2017.
In order to use this, at first, please retrieve your access token and enable Drive API.
1. File ID Retrieve file id from file name.
curl -X GET -sSL \ -H 'Authorization: Bearer ### Access token ###' \ 'https://www.googleapis.com/drive/v3/files?q=name="### FileName ###"&fields=files(id,name)' Reference : https://developers.google.com/drive/v3/reference/files/list
2. Revision ID Retrieve revision id from file id.
curl -X GET -sSL \ -H 'Authorization: Bearer ### Access token ###' \ 'https://www.