Skip to content

Instantly share code, notes, and snippets.

@haroldcris
Created August 27, 2021 15:16
Show Gist options
  • Save haroldcris/4267ae255dbd6a7c0c99e3b25a25984f to your computer and use it in GitHub Desktop.
Save haroldcris/4267ae255dbd6a7c0c99e3b25a25984f to your computer and use it in GitHub Desktop.
Get All Files in Google Drive
//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