Skip to content
Advertisement

Issue in creating script that copy the sheet and update it based on form response

I am trying to make a copy of Template in same folder when user submits the form and than update the fields in new copied sheet based on what user has submitted in the form response.

New sheet is creating successfully but response I am getting in the form is not updating in the new sheet. Need help in finding the issue in code

error showing :

TypeError: Cannot read property ‘0’ of undefined at CopySheet(Code:32:63) at getResponse(Code:3:16)

JavaScript

Edited Code :

JavaScript

Advertisement

Answer

That’s because you are accessing the 0th index of a null variable.

output

Use e.values instead:

Code:

JavaScript

and upon checking the value of the response, it should look like this.

response

  • Index 0 of response is the date the form was submitted.
  • Index 1 is the answer of the 1st question
  • Index 2 is for the 2nd question, and so on and so forth

Just use the order of the question then use it as index.

Sample:

If value of S.C.O Number is the answer of the first question, then getting the value of the answer should be response[1]

Code:

JavaScript
User contributions licensed under: CC BY-SA
3 People found this is helpful
Advertisement