Hi everyone! I got script in my sheets which does something when checkbox is (true) Script starts only when i check my checkbox in google sheets interface, but when i check that box from glide app, it does not work. What should i do. Thanks in advance.
Are you using an onEdit or onChange trigger?
As far as I’m aware, onEdit triggers will never fire with Glide initiated changes, so you need to use an onChange trigger.
I already tried that but it didnt work for me.
Okay, so “didn’t work” doesn’t tell us much.
What actually happens?
Does the trigger fire?
Is there an error?
If there is an error, what is it?
Do you want to share the code, maybe?
OK my bad.
function onEdit(e) {
const ss = e.source,
sheet = ss.getActiveSheet(),
sheetName = sheet.getName(),
range = e.range,
row = range.getRow(),
column = range.getColumn(),
value = range.getValue(),
dataRow = sheet.getRange(row, 1, 1, sheet.getMaxColumns()).getValues()[0];
switch (sheetName) {
case ‘Приход’:
if (row > 1 && column == 10 && value) {
const sheetTo = ss.getSheetByName(‘Оплата’)
sheetTo.appendRow([new Date(), dataRow[6], ‘Газ’])
}
break;
}
}
When i check checkbox in google sheet interface action happens. But when i do check from app nothing works. No errors, nothing.
As I mentioned earlier, Glide changes will not cause an onEdit trigger to fire.
You’ll need to re-write that as an onChange trigger.
No results, but thanks anyway!
So what does your refactored script look like?
onChange triggers definitely work fine with Glide, I write them every day.