List Google Drive Folder File Names and URLs to a Google Sheet | Communicating with Prisoners

PHOTO EMBED

Thu May 05 2022 20:56:15 GMT+0000 (Coordinated Universal Time)

Saved by @itsbrex

// replace your-folder below with the folder for which you want a listing
function listFolderContents() {
  var foldername = 'your-folder';
  var folderlisting = 'listing of folder ' + foldername;
  
  var folders = DriveApp.getFoldersByName(foldername)
  var folder = folders.next();
  var contents = folder.getFiles();
  
  var ss = SpreadsheetApp.create(folderlisting);
  var sheet = ss.getActiveSheet();
  sheet.appendRow( ['name', 'link'] );
  
  var file;
  var name;
  var link;
  var row;
  while(contents.hasNext()) {
    file = contents.next();
    name = file.getName();
    link = file.getUrl();
    sheet.appendRow( [name, link] );     
  }  
};
content_copyCOPY

https://www.acrosswalls.org/ortext-datalinks/list-google-drive-folder-file-names-urls/