# Script is not working

**URL:** <https://community.glideapps.com/t/script-is-not-working/26018>\
**Category:** Ask for Help\
**Created:** [April 25, 2021, 2:13pm UTC](https://community.glideapps.com/t/script-is-not-working/26018 "2021-04-25T14:13:33Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![D\_M](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/d_m/32/18650_2.png) [@D\_M](https://community.glideapps.com/u/D_M)\
**Post date:** [April 25, 2021, 2:13pm UTC](https://community.glideapps.com/t/script-is-not-working/26018/1 "2021-04-25T14:13:33Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Darren\_Murphy](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/darren_murphy/32/47326_2.png) [@Darren\_Murphy](https://community.glideapps.com/u/Darren_Murphy)\
**Post date:** [April 25, 2021, 2:19pm UTC](https://community.glideapps.com/t/script-is-not-working/26018/2 "2021-04-25T14:19:43Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![D\_M](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/d_m/32/18650_2.png) [@D\_M](https://community.glideapps.com/u/D_M)\
**Post date:** [April 25, 2021, 3:15pm UTC](https://community.glideapps.com/t/script-is-not-working/26018/3 "2021-04-25T15:15:28Z")

</div>

> [@Darren\_Murphy](#):
>
> are, onEdit triggers will never fire with Glide init

I already tried that but it didnt work for me.

---

<div class="post-metadata">

**Author:** ![Darren\_Murphy](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/darren_murphy/32/47326_2.png) [@Darren\_Murphy](https://community.glideapps.com/u/Darren_Murphy)\
**Post date:** [April 25, 2021, 3:22pm UTC](https://community.glideapps.com/t/script-is-not-working/26018/4 "2021-04-25T15:22:46Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![D\_M](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/d_m/32/18650_2.png) [@D\_M](https://community.glideapps.com/u/D_M)\
**Post date:** [April 25, 2021, 4:25pm UTC](https://community.glideapps.com/t/script-is-not-working/26018/5 "2021-04-25T16:25:26Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Darren\_Murphy](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/darren_murphy/32/47326_2.png) [@Darren\_Murphy](https://community.glideapps.com/u/Darren_Murphy)\
**Post date:** [April 25, 2021, 4:31pm UTC](https://community.glideapps.com/t/script-is-not-working/26018/6 "2021-04-25T16:31:57Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![D\_M](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/d_m/32/18650_2.png) [@D\_M](https://community.glideapps.com/u/D_M)\
**Post date:** [April 29, 2021, 5:26pm UTC](https://community.glideapps.com/t/script-is-not-working/26018/7 "2021-04-29T17:26:04Z")

</div>

No results, but thanks anyway!

---

<div class="post-metadata">

**Author:** ![Darren\_Murphy](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/darren_murphy/32/47326_2.png) [@Darren\_Murphy](https://community.glideapps.com/u/Darren_Murphy)\
**Post date:** [April 29, 2021, 5:29pm UTC](https://community.glideapps.com/t/script-is-not-working/26018/8 "2021-04-29T17:29:13Z")

</div>

So what does your refactored script look like?

onChange triggers definitely work fine with Glide, I write them every day.
