Samuele
Samuele

Reputation: 79

Set a specific sheet in a spreadsheet as form destination

I'm working on a University project with GAS and I'm stuck. I set a spreadsheet with some logic as destination to a form (I need to process the data coming from the form).

Here it is my code:

  // Create the form from a template in the folder just created
  var formFile = formTemplate.makeCopy('questionario', newFolder);
  var form = FormApp.openById(formFile.getId());

  // Create the spreadsheet from a template
  var repliesFile = responseTemplate.makeCopy('risposte', newFolder);
  var replies = SpreadsheetApp.openById(repliesFile.getId());

  // Set the destination spreadsheet for form replies
  form.setDestination(FormApp.DestinationType.SPREADSHEET, replies.getId()); 

My problem is that the form reply create a new sheet inside the spreadsheet, so my logic is not applied to the data coming from the form.

Any suggestion? Is there a way to put the data in the sheet I want? If there is not, can you suggest any workaround? Thank you all

reply spreadsheet image with the two sheet, mine and the one created by the form

Upvotes: 1

Views: 1644

Answers (1)

Wicket
Wicket

Reputation: 38160

It's not possible to set a sheet as the destination of the forms responses because there is only one method to set the form destination:

setDestination(type,id)

In order to put the data in the sheet that you want instead of using the built-in feature to send the respondes to a spreadsheet, use the form submit installable trigger and the corresponding event object

References

Upvotes: 1

Related Questions