Skip to content

Instantly share code, notes, and snippets.

@hubgit
Created September 20, 2012 11:20
Show Gist options
  • Star 31 You must be signed in to star a gist
  • Fork 13 You must be signed in to fork a gist
  • Save hubgit/3755293 to your computer and use it in GitHub Desktop.
Save hubgit/3755293 to your computer and use it in GitHub Desktop.
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);
}
};
@sannykhan3777
Copy link

sannykhan3777 commented Mar 17, 2022

I want my firebase storage and google drive synced with each other like If I upload a file to my drive it should go to firebase storage too and if I upload a file on storage it should come to my drive too.
I also want to trigger my function when I upload file on google drive or firebase storage.
Is it possible guys?
I am able to upload the folder and the file to firebase storage but its hard coded.
I want a trigger so, when drive or firebase storage changes it should trigger the function and function should take the files name either they are on drive or firebase storage and then upload it to drive or firebase either.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment