Google Apps Script Web App open a new window

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

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

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.

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?

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

1 Like

Let me know if I can help more :wink:

I guess I’m missing something :frowning:

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”)

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

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

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.

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){

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

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

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

Either in the email or in here

Thanks again.

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.

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.

Thanks guys,

image

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

And it fails with the following error message

What am I missing please?

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

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.