Advertisement
Guest User

Untitled

a guest
Jan 18th, 2020
1,135
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.06 KB | None | 0 0
  1. // From your pal Pope Snowball:
  2. // 1) Add all the images into one folder on Google Drive
  3. // 2) Go to google drive and get the folder ID (after "drive/folders/")
  4. // 3) Add it to this script below
  5. // 4) Go to Google Sheets, Tools, Script Editor, New Project, add in the script
  6. // 5) Highlight the cell you want the URLs to be entered at on your Google Sheet
  7. // 6) Hit the "Run" button in the Script Editor to run the script
  8. // Note: You will likely have to give permissions to the Google Drive from the script on first running
  9.  
  10. function myFunction() {
  11. var ss=SpreadsheetApp.getActiveSpreadsheet();
  12. var s=ss.getActiveSheet();
  13. var c=s.getActiveCell();
  14. var fldr=DriveApp.getFolderById("ADD THE GOOGLE DRIVE FOLDER ID HERE"); // Where id is after "drive/folders/" in the url of the google drive folder
  15. var files=fldr.getFiles();
  16. var names=[],f,str;
  17. while (files.hasNext()) {
  18. f=files.next();
  19. str='=hyperlink("' + f.getUrl() + '","' + f.getUrl() + '")';
  20. names.push([str]);
  21. }
  22. s.getRange(c.getRow(),c.getColumn(),names.length).setFormulas(names);
  23. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement