tanaike

The Thinker

Retrieving Specific Folders from Google Drive using Google Apps Script

Gists These are sample scripts for retrieving specific folders from Google Drive using Google Drive service (DriveApp) with Google Apps Script. Retrieving folders in own Google Drive const folders = DriveApp.searchFolders( `'${Session.getActiveUser().getEmail()}' in owners and trashed=false` ); const res = []; while (folders.hasNext()) { const folder = folders.next(); res.push(folder.getName()); } console.log(res); Retrieving folders in shared Drives const folders = DriveApp.searchFolders( `not '${Session.getActiveUser().getEmail()}' in owners and trashed=false` ); const res = []; while (folders.

Converting Gmail Message to Image using Google Apps Script

Gists This is a workaround for converting a Gmail message to a PNG image using Google Apps Script. Sample script Please set the message ID of Gmail. function myFunction() { var id = "###"; // Please set your message ID of Gmail. var message = GmailApp.getMessageById(id); var date = Utilities.formatDate( message.getDate(), Session.getScriptTimeZone(), "yyyy-MM-dd HH:mm:ss" ); var from = message.getFrom(); var to = message.

Uploading Video File on Google Drive to YouTube with Resumable Upload using Google Apps Script

Gists This is a simple sample script for uploading a video file on Google Drive to YouTube with the resumable upload using Google Apps Script. When you want to upload a video file to YouTube using Google Apps Script, when YouTube API of Advanced Google services is used, the maximum file size is 5 MB, because, in this case, the video file is uploaded with multipart/form-data. When you want to use a video file with more file size using Google Apps Script, a resumable upload is required to be used.

Curl Command Uploading Video File to YouTube with Resumable Upload using YouTube API

Gists This is a sample curl command for uploading a video file to YouTube with the resumable upload using YouTube API. In order to upload a video file to YouTube with the resumable upload using YouTube API, the following 2 processes are required to be done. The basic process of the resumable upload for YouTube is the same with Drive API. Ref So, I think that this document of Drive API might be useful for understanding the resumable upload process.