I am looking for a sample script or hint to fix the following problem. I want the file sent from the form to go to one of the folders (created earlier) depending on the respondent's answer.
More precisely, the respondent selects the group to which he is assigned and files from people in this group go to the same folder.
I found such an example
Google Form Upload files to specific new folder based on the value submitted
however, multiple subfolders with the same name are created
EDIT !
My mistake. The script works perfectly. This is a good solution.
Related
I continue to expand my project - the problem described at Selecting a subfolder to upload based on the response has been successfully resolved. Therefore, I am looking for a solution to the following problem. The respondent is to submit the file using the form. How to send him a link to this file (with download permissions but not editing) or send the file itself (e.g. by e-mail).
Folders are created based on the responses from the form, so at the stage of creating the form, I do not know the names and IDs of these folders.
I understand that you already have developed scripts for «emailing a file that is already on Google Drive or for sending a link to such a file», and your goal is to run such scripts when a file is uploaded to a Form. If my understanding of your scenario is correct, then you are very close to reaching your goals.
First of all let me clarify that the files uploaded on Form populate a Drive folder automatically. You can see in your main Drive folder (My Drive) that there is one folder for your form, and inside that folder there is one additional folder for every question in your form that requires a file upload. Please keep in mind that all respondent users will share the same folders.
Knowing the fundamentals discussed above, you only need one additional function to connect the new files in your Drive folder to your already existing scripts for mailing the files. To do so you can set up a form submit trigger that fires your scripts. To connect your scripts with the forms responses folder, you should copy the folder ID into your function. Let me know if you need further clarifications with this approach.
According to my question, I found the souliton here, how i could manage uploaded files. Google Form how to upload files and then place it into new folder based on the value submitted
(The answer "Solved")
Now, I would like to change the CHECKBOX to LIST. I want to reach that, the user could choose only one option here.
Assuming that I understand your question correctly:
is there a way to move a file from google form submission into another folder based on a rows criteria in google sheets?
I would appreciate any assistance. Thanks.
If I understood correctly your question has two parts: first you want to match a criteria in the responses Sheet. Then, you want to move a file from a folder into another one. If my understanding of the issue is correct, then you can achieve your goal with these easy steps.
In the first place you can use the TextFinder class to look for a match in the response Sheet. If there is a match, then the files should be moved from one Drive folder into another. To run that move you need to open the file first by using DriveApp.getFileById(). Then you can use File.moveTo() to move it to the other folder by providing the folder identifier (it could be done by using DriveApp.getFolderById()). Please, feel free to ask me any additional doubts.
I have been out of the programming world for some time and so am looking for any help that you may be able to provide.
I am trying to create a Google drive set up that automatically creates a new folder that is titled "mm/dd/yyyy" when it receives it's first upload of the day. The files will then continue to automatically be assigned to that folder until a 12.01am the next day, which is when another new folder would be generated once an upload is completed on that day...etc etc. Ideally the script would not create a mandatory folder every day as there will not be uploads everyday, it would only take action once the "command" of a file, photo, video is being uploaded.
Any help would be a massive help. Thanks guys.
P.s no I do not have a script to share I am relearning as we speak.
You can create a programmable pattern for this.
Create a folder using Files:create api. See documentation
Set a logic when you want to upload a file/photo/video using Files:insert or Files:update. See Files Insert and Files update.
When there's an update from your folder created, you can use the property:
enter image description here
Pass that property as date format "mm/dd/yyyy" to Files:update:
enter image description here
This will trigger again the Files:create api.
For more informations:
Uploading Files
Work with Folders
Does anyone know if I can automatically (I guess with a help of Google Script) redirect the uploeaded files to different folders depending on the choice the user makes in previous question with drop-down list?
Let's say if he chooses 'Meat', then the file goes to folder called 'Meat', if he chooses 'Fish', then to the folder 'Fish' etc.
I cannot find any examples of script for this.