0
votes

Good morning! Another Google forms question. I'm currently working on a lengthy Google form where each submission could entail the upload of about 7-8 additional documents, which are uploaded to my Google drive. Google automatically sorts the file uploads by question (i.e., all file uploads associated with question 20 go into a folder in my Google drive for question 20). Is there a way to group all uploads by USER into a single folder?

That way, instead of needing to look in 7-8 different folders in my Google drive to find all the uploads, the uploads would all be in one folder for Johnny S. or whomever.

2

2 Answers

0
votes

It is possible.

Strategy:

  • Create a bound function in form to trigger on Form Submit
  • Get Form response from the event object
  • Get all item responses and their titles from the form response
  • Item response should be the file ID for upload type items
  • Use the file ID to copy/move the file to their respective folders using DriveApp

References:

0
votes

You can write an onFormSubmit trigger that uses the DriveApp service to get a list of all files under the form's folder / subfolder and moves them to another folder. The script should also remove the files from the original folder since, in Google Drive, it is possible to have the same file in multiple folders.

Here's a snippet to move files between folders.

function moveFiles(source, target) {      
  var files = source.getFiles();    
  // this will get the files in subfolders as well
  while (files.hasNext()) {    
    var file = files.next();
    target.addFile(file);
    source.removeFile(file);    
  }
}