Detect specific changed column in Google Sheet based on add row action button


I made a script to get a specific column that changed because there is a new data inserted by a button with add row action in glide apps. But there is a problem, the script only detect column that get change is column 1. If the other column get changed, it still detect changes happen in column 1. Is it because of the behavior of add row action button? Or the glide apps add row action button input in Google Sheet will detected by the Google Apps Script as only happen in column 1 ? I quite new with using glide apps. Thank you

If a row is being added, then there will always be a change in the first column, right?
It’s just a matter of writing your script in a way to handle new rows being added.

1 Like

But the button of add row action in my glide apps will only insert a value on the specific column. So, i think the changes will happen only on the specific column of inserted new row, right? @Darren_Murphy


It might be useful if you can provide a bit more context.
What does your script do, and what is your ultimate goal?
If you can explain the larger context of what you are trying to do, it’s quite possible that we can show you a way without having to bother with Apps Script at all.

Apps Script is a very powerful tool for extending the capabilities of Glide Apps, but the Glide Data Editor is also very powerful. Many things that could only be done with Apps Script in the past are now easily achievable inside the Glide Data Editor.

My script will run a process if there are any changes on the specific sheet and a specific column. The add row action button will insert a current date to Google Sheet whenever some User click on the button and it will trigger the script as long as the condition is right. It’s like to update the data in the Google Sheet and to refresh the glide apps data. @Darren_Murphy

Here is my script and it will using the installable onChange trigger to run.

function myFunction(e) {
  var sheet = e.source.getActiveSheet().getName();
  var row = e.source.getActiveCell().getRow();
  var col = e.source.getActiveCell().getColumn();
  if (sheet == "sheetname") {
    if (row >= 2 && col == 1) {
    if (row >= 2 && col == 2) {
    if (row >= 2 && col == 3) {

Okay, so what do each of function1(), function2() and function3() do?
Again, it’s quite possible that each of those can be done inside Glide without having to use Apps Script.

One thing to be aware of is if you are using Apps Script (or even spreadsheet formulas) to update your data, then you are introducing a sync delay into your Glide App, which may result in a less than ideal user experience. So it’s always better to do as much as possible inside Glide. Glide computations take place on the end user device, so results will always be instant.

Those function will update the spreadsheet data. I think it’s quite complex because the data itself was from other spreadsheet, like import range formula. But back to the first line of the script, the variable col that being used for detect the changes still read the changes happen on the column 1. @Darren_Murphy


Well, I don’t have time to dive deeply into this right now, so let’s just address your immediate issue.

What you need to do is adjust your trigger so that it reads the entire row, and then looks at the value in each column individually. If it’s not what’s expected, then call the secondary function. Once that is done, reset the value so that it can be triggered again. This is the canonical approach.

1 Like

Thank you for your help! I think I know the problem from your first reply. The problem is the add row action will input null value to the other columns. So, even if I specify a value in column 2, the other columns will still get a null value. That’s why the script detect the column 1 is changing because there is a inserted null or empty value in it. I apologize for my bad understanding @Darren_Murphy

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.