Skip to content

Instantly share code, notes, and snippets.

@perXautomatik
Forked from hubgit/list-files-in-folder.js
Last active December 7, 2019 18:48
Show Gist options
  • Save perXautomatik/7ef4c2ccb795ea7ee4c228325fbf2afa to your computer and use it in GitHub Desktop.
Save perXautomatik/7ef4c2ccb795ea7ee4c228325fbf2afa to your computer and use it in GitHub Desktop.
GS - List all files in a folder (Google Apps Script)
function listFilesInFolder() {
var folder = DocsList.getFolder("Maudesley Debates");
var contents = folder.getFiles();
var file;
var data;
var sheet = SpreadsheetApp.getActiveSheet();
sheet.clear();
sheet.appendRow(["Name", "Date", "Size", "URL", "Download", "Description", "Type"]);
for (var i = 0; i < contents.length; i++) {
file = contents[i];
if (file.getFileType() == "SPREADSHEET") {
continue;
}
data = [
file.getName(),
file.getDateCreated(),
file.getSize(),
file.getUrl(),
"https://docs.google.com/uc?export=download&confirm=no_antivirus&id=" + file.getId(),
file.getDescription(),
"audio/mp3"
];
sheet.appendRow(data);
}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment