6

I've got 200+ jpegs in a folder and need shareable links for each jpeg in a spreadsheet. Is there a way to do this without doing the right clicking thing for each image individually?

6

Yes, you can select all these files and get shareable links to them at once.

  1. Select files
  2. Right-click any of them and pick "Share.." out of the context menu.
  3. Click "Get shareable links" in the upper right corner of the Share dialog window. This does several things at once: makes files accessible to anyone with a link, and copies the links to your clipboard.
  4. Paste into the spreadsheet. The copied links are newline-separated, so when pasted into a spreadsheet, they form a neat column.
| improve this answer | |
  • newline-separated, so when pasted into a spreadsheet, they form a neat column UPDATE May 2020: The links are separated by ",%20" (comma-space?). When the links are pasted, they don't automatically form a column. The user has two options: 1) "Data> Split Text to Columns": the links will split into columns though all but the first link will be preceded by "%20"; or 2) "Paste special", "Paste transposed": the links will form a neat column, though all but the first link will be preceded by "%20". – Tedinoz Aug 6 at 22:59
5

With a very large number of files (50+), a method without painful clicking is the following:

  1. Open the desired Google Drive folder and get its ID in the URL from the browser location bar: https://drive.google.com/drive/u/0/folders/<id>

  2. Open a new Google Sheet and navigate Tools > Script editor. In the new script, put (replace the <id> in the code):

    function myFunction() {
      var ss=SpreadsheetApp.getActiveSpreadsheet();
      var s=ss.getActiveSheet();
      var c=s.getActiveCell();
      var fldr=DriveApp.getFolderById("<id>");
      var files=fldr.getFiles();
      var names=[],f,str;
      while (files.hasNext()) {
        f=files.next();
        str='=hyperlink("' + f.getUrl() + '","' + f.getName() + '")';
        names.push([str]);
      }
      s.getRange(c.getRow(),c.getColumn(),names.length).setFormulas(names);
    }
    
  3. Save the script and grant permissions

  4. Run the script

If you revisit the Google Sheet, it should now contain the list of URLs of the files.

(I stole most of this from https://productforums.google.com/forum/#!topic/docs/0ilSDjhFnHI)

| improve this answer | |
  • You saved me a lot of time! I know this comment is not intended for this purpose, but thanks! – Mihai Jan 14 at 14:02
  • If you like this answer, also take a look at @user79865's answer. They explained that this is possible with a single share + a single "Copy Links" click, which IMO is simpler and more straightforward than this solution. It's exactly what I was looking for. – rd11 Feb 13 at 15:43
  • One thing IIRC @rd11 is that if you have really 200+ files, selecting them in Drive is a pain. You can't do this for say more than 50 files, as in the OP question. – Davide Fiocco Feb 13 at 17:59
  • 1
    That's a great good point. I do think my comment is useful, though, as anyone searching for the <50 files use case will likely be tunneled to this answer immediately through a web search (as I was). Cheers. – rd11 Feb 19 at 15:07

Not the answer you're looking for? Browse other questions tagged or ask your own question.