Working With Binary Files In Google Drive Using Apps Script
Working with binary files in Google Drive using Apps Script can be challenging due to authorization patterns. Learn how to obtain a file's Blob using DriveApp, Drive Advanced Service & UrlFetchApp while minimizing restricted scopes.
Apps Script is often a convenient way to interact with Google Drive files. However, there are challenges when working with binary files like PDFs or images, specifically related to scopes. These challenges arise from the different authorization patterns: Running a script manually : any scope can be used. Running a script or function bound to a Google Workspace document : any scope can be used, but it is recommended to minimize the required scopes. Running a script as a Workspace Add-on : the minimal scope must be used, and restricted scopes like https://www.googleapis.com/auth/drive should be...