0

I have a google form with 3 questions.

Data collected are sent to a google sheet.

I have a function that performs auto sorting based on 1 column.

I execute this function inside onEdit and onChange functions.

However, when a new row comes in from the Form those functions won't get triggered and there's no sorting being made. I have to manually edit some cell to trigger it.

Is there an event that is being triggered when a new row comes in from the Form that I am unaware of?

xray1986
  • 1,148
  • 3
  • 9
  • 28
  • Does this answer your question? [How to get onFormSubmit to trigger automatically?](https://stackoverflow.com/questions/17992718/how-to-get-onformsubmit-to-trigger-automatically) – jbra95 Jan 22 '20 at 11:07

1 Answers1

3
  • onEdit triggers only for edits made manually by humans,not for rows added programmatically by a background proccess.
  • onChange behaves usually in the same way (there are few exceptions, such as edits triggered by IMPORTRANGE).

But see here:

An installable form submit trigger runs when a user responds to a form. There are two versions of the form-submit trigger, one for Google Forms itself and one for Sheets if the form submits to a spreadsheet.

This is the trigger you need to implement. It is an installable trigger that you can bind to your function in the same way like the onChange trigger and it trigger on each form submit. It can be used in a script bound to either your form or your destination spreadsheet, whereby in your case the latter makes more sense.

ziganotschka
  • 25,866
  • 2
  • 16
  • 33
  • 1
    That's what I ended up doing. I already tried having an onFormSubmit(e) function but I found out later about the installable triggers. I will accept the answer of course. – xray1986 Jan 23 '20 at 09:36