Home > Enterprise >  Google forms appscript email sends only one form value
Google forms appscript email sends only one form value

Time:12-02

I tried creating an appscript to send an email.

Form Url: enter image description here

I need all the options in the form to be sent in email. Could you help me on what I'm doing wrong?

CodePudding user response:

You are not iterating inside all the questions inside the form, I created a simplified sample, you can test it out and apply the changes to your code or use the sample.

I created the code based on the enter image description here

For this case, I enter image description here

I tested filling out the form with multiple users (inside of workspace and Gmail.com,) and the email was sent without issues. Even if the other users didn’t have the trigger installed.


Update to hide the Responses Number (The 16):

To remove the number for 16. The answer to the question... you need to change:

 questions  = (i   1).toString()   '. The answer to the question "' 
        itemResponse.getItem().getTitle()   '" was "'   itemResponse.getResponse() 
        '"\n'

for:

 questions  = 'The answer to the question "' 
        itemResponse.getItem().getTitle()   '" was "'   itemResponse.getResponse() 
        '"\n'

Update to number the questions:

Replace:

questions  = (i   1).toString()   '. The answer to the question "' 
        itemResponse.getItem().getTitle()   '" was "'   itemResponse.getResponse() 
        '"\n'

for:

questions  = (j   1).toString()   '. The answer to the question "' 
        itemResponse.getItem().getTitle()   '" was "'   itemResponse.getResponse() 
        '"\n'
  • Related