Trigger google script function from AppSheet ...

(Michael) #1

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.

(Levent KULAÇOĞLU) #2

@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.

(Michael) #3

@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?

(Levent KULAÇOĞLU) #4


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: From hamburger menu, choose BLOG


(Michael) #5

@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.

(Levent KULAÇOĞLU) #6

@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).

(Levent KULAÇOĞLU) #7

@Michael provided you cannot figure it out, just drop me a line at

(Praveen Seshadri (AppSheet)) #8

@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.

(Levent KULAÇOĞLU) #9

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.

(Henry Scott) #10

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

(Praveen Seshadri (AppSheet)) #11

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)

(Levent Kulacoglu) #12

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 :slight_smile: and with the power of scripting AppSheet turns into a devil :slight_smile:

(Henry Scott) #13

@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.