Created
December 1, 2021 19:51
-
-
Save jok3rcito0/bfa43d196639f4451aa1d324ca90a55c to your computer and use it in GitHub Desktop.
Get file names from gdrive and save file names on gsheet
This file contains hidden or 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 myFunction() { | |
var foldername = 'fotosh'; | |
var folderlisting = 'listing of folder ' + foldername; | |
var folders = DriveApp.getFoldersByName('fotosh'); | |
while (folders.hasNext()) { | |
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(); | |
Logger.log(file.getName()); | |
sheet.appendRow( [name, link] ); | |
} | |
} | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment