Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

282
Views
how to get new response from a google form to different folders based on the form input value

I have a form contains questions

  1. BL number
  2. Importer code
  3. Upload file when each user submit response, files should be saved in different folders and folder name should be input value of question "BL number". how we can make it possible ?
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

It heavily depends on how your form looks like.

Here is an example how it could be done.

Suppose you have a very simply form like this:

enter image description here

It has two 'namedValues': Folder and File, they will be used in the script below.

Next step: You have to add a 'linked' spreadsheet to the form.

enter image description here

In this spreadsheet you have to add this script:

// names and IDs of your destination folders

var folders = {
  'aaa' : '###', // <-- you have to change ### with a real ID
  'bbb' : '###',
  'ccc' : '###'
}

function move_file_to_folder(e) {

  // get folder ID from folders object
  var folder_id = folders[e.namedValues['Folder'][0]]; // <-- the name from the named value 'Folder'

  // get file ID from the form
  var file_id = e.namedValues['File'][0].split('id=')[1]; // <-- the url from the named value 'File'

  // move the file into the folder
  DriveApp.getFileById(file_id).moveTo(DriveApp.getFolderById(folder_id));
}


// this function should be run just once to install the trigger

function install_OnFormSubmitTrigger() {
  var ss = SpreadsheetApp.getActive();
  ScriptApp.newTrigger('move_file_to_folder')
      .forSpreadsheet(ss)
      .onFormSubmit()
      .create();
}

After that you have to run the function install_OnFormSubmitTrigger() to install the trigger.

Probably it makes sense to run the function move_file_to_folder() as well, in order to get the propper access. It will get you an error. Don't mind. Keep calm and carry on.

Now, every time you submit the form the uploaded file will go into a folder with respective name ('aaa', 'bbb', 'ccc' in my example).

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!