I have a bunch of PDF files in a single folder (say "myPDFs") in my Google Drive.
I have a Google Sheet stored in the same Google Drive. One column of this Sheet has the filenames of the PDF files. (eg: "apple.pdf", "banana.pdf", etc.) I would like to transform each of these into a link to the corresponding file.
I know I can use the hyperlink
function to create a link from a URL and link text, but the URL for the files (what Drive calls the "shareable link") is not easily computable from the filename. eg: myPDFs/apple.pdf
might have a URL like https://drive.google.com/open?id=Ia18d1uTYY5jfdyrhodAJ7Xofk4g0bLm5
. I do not want to have to manually retrieve the "shareable link" from the Drive UI, as there are several hundred files involved.
I tried making a custom function that uses DriveApp.getFilesByName
to find the URL for each filename, but apparently that function cannot be called from a custom function.
How can I easily link to these files from my sheet?