Google Script: How to spot new sheet entry via form button if it's an EDIT event, not INSERT_ROW?

It seems that when a new item is created by Glide via form button, it is added to the spreadsheet in a way that the resulting change event seen in a script is EDIT and not INSERT_ROW.

Can you please confirm the observation?

The problem it creates is that it becomes very hard to determine if a new item was added, e.g. in order to send out an email notification. In fact, I can’t figure out how this can be achieved at all. From the scripts point of view it is indistinguishable whether glide added a new entry or an existing entry was edited. Any suggestions or examples how to achieve this?

I consider this a Glide problem, because even though you don’t strictly have to use INSERT_ROW, because you’re filling an empty row at the end of the occupied range, Glide should do it nevertheless to provide the explicit signal via the script event. Having this would make it super easy to send out a welcome email to new users, for example!

Thank you!

1 Like

Interesting. This is probably why when I have multiple new rows, Zapier doesn’t get trigger multiple time.
Will follow this thread for sure.

@david any idea how we can fix this? This is making Zapier useless with sheets since it doesn’t trigger adequately.

I use a timed trigger on a function that scans a sheet from the bottom up. Before there was a special value component I would have a column called edited date. If it was blank I would know it was a recent row and would send the email if that is what I wanted and then update the empty cell with the current datetime. I save off the last datetime of the scan and compare that against the datetime on the row and trigger other events based on if the row was edited (again based on the special value datetime component saving it’s value to that column.)

1 Like

I’m not well versed in Google’s API. This is trickier than one would think. I see two solutions for my case.

  1. temporary for now:
  • trigger off an EDIT change event
  • Use Glide’s “current date/time” special value saved in one of the columns and compare it to the current time. If it’s within a certain range, say 10 sec., I assume the row is new.
  • this is very flimsy at best, so I’m probably going to follow George B.'s advice in the post above and create a dedicated date column which gets filled by my script after the event is processed. If it’s empty, I know it’s a new row (or one that has not been processed).
  1. proper insert

Instead of using only new row and used new row or edit in the Zapier and I think it may work. Will let you know guys when I have new orders. :slight_smile:

Hi @j.h.scheufen

You must use as trigger the onChange() event instead to your script to detect a new row.

I already walked that road days ago


Rather than check and compare date times with a script. Why not just have a column that’s not filled by the app, but when the script runs, it look for an empty value in that column and then fills it when it’s done processing it. Basically @George_B’s answer but without dealing with dates.

Hi Jeff,

I did implement a simple Y/N value column to control notifications. Works just fine. Thanks again!

1 Like