I have a name in cell A2 eg;
A2="Giraffe"
i have a specific folder in which i have a file named "Giraffe"
Can google sheets find the file and get the link in the output cell B2
I have a name in cell A2 eg;
A2="Giraffe"
i have a specific folder in which i have a file named "Giraffe"
Can google sheets find the file and get the link in the output cell B2
2
Answers
In your situation, how about the following sample script?
Sample script 1:
Before you use this script, please set
sheetName
andfolderId
. When this script is run, a filename is retrieved from "A2" and when the file of filename exists, the link of the file is put into "B2".Sample script 2:
Before you use this script, please set
sheetName
andfolderId
. When this script is run, the filenames are retrieved from "A2:A" and when the files of filenames exist, the links of the files are put into "B2:B".Added:
Although, unfortunately, I cannot know your actual situation, about
i have a specific folder in which i have a file named "Giraffe"
, I’m worried that the files might be put into the subfolders undera specific folder
. If my understanding is correct, please test the following sample script. The following script retrieves the files under the folder including the subfolders. But, this is just my guess.Another approach:
If no links of the files are put to column "B" even when the above script, it is considered that the files of the filenames of column "A" do not exist in the folder. At that time, please test the following script. When the following script is run, all files in the folder are retrieved. And, the filenames and the file links are put into columns "B2:C".
sheet.getRange(2, 2, values.length, values[0].length).setValues(values);
tosheet.getRange(2, 1, values.length, values[0].length).setValues(values);
.It is not a built-in functionality of any of google’s APIs. However with some knowledge of a programming language. This can be trivially done with Google Sheets API and Google Drive API
Google Sheets API Reference
Google Drive API Reference