This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Google Apps Script: Get Target File through Google Drive by ID, open as a spreadsheet. | |
/** Find a file in Google Drive by ID. | |
* fileID - fileID, which you can get from the ID section of the file URL | |
* return the file opened as a Spreadsheet | |
*/ | |
function getSpreadsheetFromFileId(fileID) { | |
var file = DriveApp.getFileById(fileID); | |
if (!file) { | |
throw new Error("Critical file missing for script to work"); |