# Google Apps Script Web App open a new window

**URL:** <https://community.glideapps.com/t/google-apps-script-web-app-open-a-new-window/16770>\
**Category:** Ask for Help\
**Created:** [October 5, 2020, 10:54am UTC](https://community.glideapps.com/t/google-apps-script-web-app-open-a-new-window/16770 "2020-10-05T10:54:07Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ryan](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/ryan/32/15941_2.png) [@Ryan](https://community.glideapps.com/u/Ryan)\
**Post date:** [October 5, 2020, 10:54am UTC](https://community.glideapps.com/t/google-apps-script-web-app-open-a-new-window/16770/1 "2020-10-05T10:54:08Z")

</div>

Hi,  
When linking a web app URL from within Glide, a chrome window opens up.  
In my case, the window returns nothing (“The script completed but did not return anything.”) which is technically great, but a bit lame from the end-user perspective.

Is there a way to trigger and execute the web app in the background other than opening and passing the user to a new Chrome window?

Thanks

---

<div class="post-metadata">

**Author:** ![ThinhDinh](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/thinhdinh/32/49_2.png) [@ThinhDinh](https://community.glideapps.com/u/ThinhDinh)\
**Post date:** [October 5, 2020, 12:34pm UTC](https://community.glideapps.com/t/google-apps-script-web-app-open-a-new-window/16770/2 "2020-10-05T12:34:37Z")

</div>

Just to confirm, you’re trying to open another Glide app inside a Glide app?

---

<div class="post-metadata">

**Author:** ![Ryan](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/ryan/32/15941_2.png) [@Ryan](https://community.glideapps.com/u/Ryan)\
**Post date:** [October 5, 2020, 9:49pm UTC](https://community.glideapps.com/t/google-apps-script-web-app-open-a-new-window/16770/3 "2020-10-05T21:49:54Z")

</div>

Hi,  
Not really.

I’m trying to trigger a GApps script using a link,  
and I would like it to run in the background rather than opening a new chrome tab.

---

<div class="post-metadata">

**Author:** ![ThinhDinh](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/thinhdinh/32/49_2.png) [@ThinhDinh](https://community.glideapps.com/u/ThinhDinh)\
**Post date:** [October 6, 2020, 1:18am UTC](https://community.glideapps.com/t/google-apps-script-web-app-open-a-new-window/16770/4 "2020-10-06T01:18:58Z")

</div>

Can we know more about what type of script you’re triggering?

I’m thinking you can set an increment action on the button and trigger based on a change in the corresponding cell in the Sheet. Would that work?

---

<div class="post-metadata">

**Author:** ![Ryan](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/ryan/32/15941_2.png) [@Ryan](https://community.glideapps.com/u/Ryan)\
**Post date:** [October 6, 2020, 11:03pm UTC](https://community.glideapps.com/t/google-apps-script-web-app-open-a-new-window/16770/5 "2020-10-06T23:03:10Z")

</div>

Great catch,  
I’ll do just that, thank you.

---

<div class="post-metadata">

**Author:** ![ThinhDinh](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/thinhdinh/32/49_2.png) [@ThinhDinh](https://community.glideapps.com/u/ThinhDinh)\
**Post date:** [October 6, 2020, 11:18pm UTC](https://community.glideapps.com/t/google-apps-script-web-app-open-a-new-window/16770/6 "2020-10-06T23:18:53Z")

</div>

Let me know if I can help more 😉

---

<div class="post-metadata">

**Author:** ![Ryan](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/ryan/32/15941_2.png) [@Ryan](https://community.glideapps.com/u/Ryan)\
**Post date:** [October 7, 2020, 10:22pm UTC](https://community.glideapps.com/t/google-apps-script-web-app-open-a-new-window/16770/7 "2020-10-07T22:22:58Z")

</div>

I guess I’m missing something ☹

Using the code below, manually update over GSheets works yet update using Glide (i.e. increment update) doesn’t work and the function doesn’t fire up. Any thoughts?

function onEdit(e){

var ActiveSheet = SpreadsheetApp.getActiveSpreadsheet().getSheetByName(“Next Event”);

if(e.range.getColumn() == 4 && e.range.getRow() \>1){  
var PlayersSpreadsheet = SpreadsheetApp.getActive().getSheetByName(“Players”)  
var ConfigSpreadsheet = SpreadsheetApp.getActive().getSheetByName(“Parameters”)  
…

---

<div class="post-metadata">

**Author:** ![ThinhDinh](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/thinhdinh/32/49_2.png) [@ThinhDinh](https://community.glideapps.com/u/ThinhDinh)\
**Post date:** [October 7, 2020, 10:25pm UTC](https://community.glideapps.com/t/google-apps-script-web-app-open-a-new-window/16770/8 "2020-10-07T22:25:28Z")

</div>

Did you trigger it with an “on change” event?

---

<div class="post-metadata">

**Author:** ![Ryan](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/ryan/32/15941_2.png) [@Ryan](https://community.glideapps.com/u/Ryan)\
**Post date:** [October 7, 2020, 11:10pm UTC](https://community.glideapps.com/t/google-apps-script-web-app-open-a-new-window/16770/9 "2020-10-07T23:10:45Z")

</div>

All I need to do is replace “function onEdit(e)” with “function onChange(e)”?

---

<div class="post-metadata">

**Author:** ![ThinhDinh](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/thinhdinh/32/49_2.png) [@ThinhDinh](https://community.glideapps.com/u/ThinhDinh)\
**Post date:** [October 8, 2020, 2:48am UTC](https://community.glideapps.com/t/google-apps-script-web-app-open-a-new-window/16770/10 "2020-10-08T02:48:19Z")

</div>

In the trigger you use, change the event type to “On change”. The function name won’t change anything in this case as far as I aware.

 ![image](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/2X/8/81c3cc7bf17ef8ebc84b6f24b7958c62acce691e.png)

---

<div class="post-metadata">

**Author:** ![Ryan](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/ryan/32/15941_2.png) [@Ryan](https://community.glideapps.com/u/Ryan)\
**Post date:** [October 8, 2020, 3:45am UTC](https://community.glideapps.com/t/google-apps-script-web-app-open-a-new-window/16770/11 "2020-10-08T03:45:51Z")

</div>

It fails at row #3 with an “TypeError: Cannot read property ‘getColumn’ of undefined” error message when trying to trigger via Glide incremental change

function onChange(e){  
var ActiveSheet = SpreadsheetApp.getActiveSpreadsheet().getSheetByName(“Next Event”);  
if(e.range.getColumn() == 4 && e.range.getRow() \>1){

---

<div class="post-metadata">

**Author:** ![ThinhDinh](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/thinhdinh/32/49_2.png) [@ThinhDinh](https://community.glideapps.com/u/ThinhDinh)\
**Post date:** [October 8, 2020, 4:23am UTC](https://community.glideapps.com/t/google-apps-script-web-app-open-a-new-window/16770/12 "2020-10-08T04:23:26Z")

</div>

You have to add a trigger using Edit \> View current project’s trigger instead of running it using the “Run” button.

---

<div class="post-metadata">

**Author:** ![Ryan](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/ryan/32/15941_2.png) [@Ryan](https://community.glideapps.com/u/Ryan)\
**Post date:** [October 8, 2020, 11:46pm UTC](https://community.glideapps.com/t/google-apps-script-web-app-open-a-new-window/16770/13 "2020-10-08T23:46:44Z")

</div>

Cheers,  
that’s what I tried yet it’s coming with the same error message →

> [@Ryan](#):
>
> “TypeError: Cannot read property ‘getColumn’ of undefined”

---

<div class="post-metadata">

**Author:** ![ThinhDinh](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/thinhdinh/32/49_2.png) [@ThinhDinh](https://community.glideapps.com/u/ThinhDinh)\
**Post date:** [October 8, 2020, 11:55pm UTC](https://community.glideapps.com/t/google-apps-script-web-app-open-a-new-window/16770/14 "2020-10-08T23:55:50Z")

</div>

Where do you see that error? In a mail sent to your account?

---

<div class="post-metadata">

**Author:** ![Ryan](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/ryan/32/15941_2.png) [@Ryan](https://community.glideapps.com/u/Ryan)\
**Post date:** [October 9, 2020, 12:09am UTC](https://community.glideapps.com/t/google-apps-script-web-app-open-a-new-window/16770/15 "2020-10-09T00:09:38Z")

</div>

Either in the email or in here

 ![image.png](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/2X/9/97d227429623a95e76f46c7dabbf66dbedf197ab.png)

Thanks again.

---

<div class="post-metadata">

**Author:** ![ThinhDinh](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/thinhdinh/32/49_2.png) [@ThinhDinh](https://community.glideapps.com/u/ThinhDinh)\
**Post date:** [October 9, 2020, 12:42am UTC](https://community.glideapps.com/t/google-apps-script-web-app-open-a-new-window/16770/16 "2020-10-09T00:42:07Z")

</div>

In my experience, I only get this error when I try to run a script with an event value using the run button.

If you have actuallly configured all of this and the trigger the right way, it should run when you have an action that changes your sheet. Otherwise I don’t know what’s the problem here without seeing a video.

---

<div class="post-metadata">

**Author:** ![Jeff\_Hager](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/jeff_hager/32/43_2.png) [@Jeff\_Hager](https://community.glideapps.com/u/Jeff_Hager)\
**Post date:** [October 9, 2020, 4:05am UTC](https://community.glideapps.com/t/google-apps-script-web-app-open-a-new-window/16770/17 "2020-10-09T04:05:15Z")

</div>

Yeah, like @ThinhDinh said, I would remove the event parameter. Your function can be called whatever you want, and with the trigger set up to run onChange, it will be called any time the sheet changes, so you will want to code to only look at certain columns in certain sheets.

---

<div class="post-metadata">

**Author:** ![Ryan](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/ryan/32/15941_2.png) [@Ryan](https://community.glideapps.com/u/Ryan)\
**Post date:** [October 9, 2020, 4:58am UTC](https://community.glideapps.com/t/google-apps-script-web-app-open-a-new-window/16770/18 "2020-10-09T04:58:04Z")

</div>

Thanks guys,

![image](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/2X/0/04355a1a4250c8110d4605aa83618218dec14096.png)

Using “Current project’s triggers” I set the following trigger

 ![image](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/2X/9/9dd78c9104f7efd60172ad58d495fb26eb11215b.png)

 ![image](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/2X/7/7a8498bedd9a32ba28c482b7ef4d36cca3ea477a.png)

And it fails with the following error message

 ![image](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/2X/8/8b085d925acb3cd7789a02dfeebf8c7d6476cd78.png)

What am I missing please?

---

<div class="post-metadata">

**Author:** ![ThinhDinh](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/thinhdinh/32/49_2.png) [@ThinhDinh](https://community.glideapps.com/u/ThinhDinh)\
**Post date:** [October 9, 2020, 5:13am UTC](https://community.glideapps.com/t/google-apps-script-web-app-open-a-new-window/16770/19 "2020-10-09T05:13:12Z")

</div>

Did it fail upon a run button push from you or an actual edit from the app?

---

<div class="post-metadata">

**Author:** ![Jeff\_Hager](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/jeff_hager/32/43_2.png) [@Jeff\_Hager](https://community.glideapps.com/u/Jeff_Hager)\
**Post date:** [October 9, 2020, 12:27pm UTC](https://community.glideapps.com/t/google-apps-script-web-app-open-a-new-window/16770/20 "2020-10-09T12:27:40Z")

</div>

You still have the (e) event parameter. There are no parameters to pass when using triggers. Any sheet changes will run the trigger and you need to specify in the code which sheet and column to look at. The error is telling you that nothing was passed in for (e), so e.range.column has no cell to look at. (e) is undefined because nothing was passed in for it.

[Next page](https://community.glideapps.com/t/google-apps-script-web-app-open-a-new-window/16770.md?page=2)
