Trigger google script function from AppSheet ...

Trigger google script function from AppSheet -

Is this possible? I have built a few custom functions inside my app’s spreadsheet and I’d like to be able to trigger them from within the app. The functions are rather simple; they copy data from one sheet into another.

1 13 4,374
13 REPLIES 13

@Michael Yes it’s possible. To accomplish this, you should a bit alter your script(s) and add a doPost(e) function in the first hand. Then, publish your script project as a Webapp which will give you an externally executable URL. Note down that URL.

To trigger your macro code now from AppSheet, you have to construct a Workflow with Webhook option. For webhook URL, copy your given URL in above step. Construct your JSON payload and it’s done.

@Levent_KULACOGLU Oh, that sounds like a lotta work… can you provide any reference material that could get me started? My scripting experience with GAS & Java is quite limited… And web hooks… heard of them but never tried to implement one.

Also, how secure would this be?

@Michael

First of all, the approach totally depends on what you do with that snippets. If they are taking parameters, than as I said above you should be setting a JSON payload for that. If they are not accepting any parameters and can be executed directly with a doPost(e) call, then it’s easy. You may want to read my blog posts in our website also for this: http://www.able3ventures.com. From hamburger menu, choose BLOG

ABLE3 VENTURES, LLC able3ventures.com

@Levent_KULACOGLU It’s fairly simple and requires nor accepts input. Four simple functions that when chosen, copy data from one sheet to another. Based on your previous response, I suspect doPost(e) would be the way to go. I will read through your site and see what I can come up with.

@Michael may be remind you that use of Webhook Workflow rule requires that your app shall be in PREMIUM plan. If your app is on STANDARD plan, than you should be using an onChange(e) event handler rather than doPost(e).

@Michael provided you cannot figure it out, just drop me a line at levent@able3ventures.com

@Levent_KULACOGLU, reminder again — we would love to publish a blog post about how to connect an AppSheet app to an AppScript. Just waiting for you to write it.

You’re right @praveen, I have promised you to do that. We are a bit overwhelmed with the works so I couldn’t be able to keep my promise. Sorry for that. I will try to do that next week and keep you posted.

@praveen did @LeventK find some time yet to do this and help our mear mortals

Hi Henry, no I don’t believe so :], but I’m sure your reply will remind him to do so

That said, what are you trying to use the appscript for? One of my medium-term goals is to eliminate the need for appscript (that is code after all, and actually somewhat difficult to debug)

@praveen
Yes I remember that and I know that I’m the guilty here. But really overwhelmed with work. I promise this time, I will write a post under Tips&Tricks in the first week of June. Really promise this time. We do love AppScript and with the power of scripting AppSheet turns into a devil

@praveen was looking in getting a Customer Registration details on my Wordpress site and the subsequent Product he buys from my Woocommerce Shop to land in my CRM on Appsheet that is hosted with Google Sheets. I went the Zapier route because of my misunderstanding that the Appsheet API integration is part of the Business Subscription, which at this stage I cannot afford, and used a Plugin in Woocommerce that works with Zapier and busy getting the Wordpress Integration going. In my chat with @LeventK GAS came up and the Appsheet API and as I said thought I needed the Business Subscription. It seems now that I can create a standalone web-app, and use its URL as an endpoint URL in a webhook workflow.

Does anyone know of an example post on how to call Apps Script from App Sheet? I know this thread is two years old so was hoping for some progress.

Top Labels in this Space