Created
August 27, 2021 15:16
-
-
Save haroldcris/4267ae255dbd6a7c0c99e3b25a25984f to your computer and use it in GitHub Desktop.
Get All Files in Google Drive
This file contains 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
//Open GoogleSheet and Script | |
function list_all_files_inside_one_folder_without_subfolders(){ | |
var sh = SpreadsheetApp.getActiveSheet(); | |
var folder = DriveApp.getFolderById('1uF19N4LJzyt7sc_vz7h0Gs1B0k7VqdWP'); // I change the folder ID here | |
var list = []; | |
list.push(['Name','ID','Size']); | |
var files = folder.getFiles(); | |
while (files.hasNext()){ | |
file = files.next(); | |
var row = [] | |
row.push(file.getName(),file.getId(),file.getSize()) | |
list.push(row); | |
} | |
sh.getRange(1,1,list.length,list[0].length).setValues(list); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment