Set column Value or other value inputs

Hi Guys,

Can someone explain to me why sending information from set column value doesn’t actually set the column value?

I have a script that if a cell (W2) is changed, my sheet will delete everything in cells C2:T5

function onEdit(e) {
var sheet = e.source.getActiveSheet();
if (e.range.getA1Notation() == “W2”) {
var range = sheet.getRange(“C2:T5”);
range.clearContent();
}
}

I created an action to set column value in W2 to True and then to false when a button is pressed, this does add a true and false statement to the cell W2 but the script doesn’t see this.

If I go to the google sheet and do what I just asked glide to do the script does work.
It’s not just set column value either, it’s anything I use in glide to send information to the required cell.

So what gives? Even though the information is visible on the sheet - does the sheet see it as we do?

I have accomplished what I needed to do by integrating integromat - glide - google sheets - clear cells C5:T5

But am curious as to why my set column value doesn’t do the same thing. So can anyone explain why not, please?

Changes from Glide do not trigger the onEdit event. Only changes directly in the sheet will do that. Only the onChange event will trigger when changes come from Glide. But, there is one caveat. Any change to any cell in any sheet will trigger the onChange event, so you need to make sure that your script is only acting on the sheet tab that you want. Otherwise it could be triggered by a change in another sheet tab and might clear the wrong content.

1 Like

Thanks, Jeff appreciate the info. That explains a lot. And thanks for the reminder about changing the script. I meant to do that and forgot, Have it changed now.

function onEdit(e) {
var sheet = e.source.getActiveSheet();
if (sheet.getName() == “Players” && e.range.getA1Notation() == “W2”) {
var range = sheet.getRange(“C2:T5”);
range.clearContent();
}
}

regards

Tom

1 Like

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