-
-
Save perXautomatik/7ef4c2ccb795ea7ee4c228325fbf2afa to your computer and use it in GitHub Desktop.
GS - List all files in a folder (Google Apps Script)
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
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