I'm building a query and editing system for a google spreadsheet used as a database. As I have several functions already written in the Google API (Google script) that I trigger in the spreadsheet through a button, I would like to know if I can trigger this same function from the environment of a rettol application. Thanks
It looks like Google Apps Script has a REST API. I think you might create a resource in Retool with an associated query that hits one of those endpoints to run your script. Let me know if that helps!
Thanks for the answer. That's right! what I did was publish the AppScript code as a web application and call it via http doget. that's it! Thank you!
I've done as was suggested here and it does work but does anyone know if it's possible to add some authentication. I've only managed to get it to work where the appscript.json is set to use access as ANYONE_ANONYMOUS, ideally I would like to use DOMAIN.
So for the absolute LIFE of me, I could not get this method to work. My Apps Scripts had too many scopes that required authentication and they weren't talking to each other appropriately.
So on the hunt for a different solution, I found one after several hours that may hopefully save the next sorry chap trying to do the same a couple hours.
In your Apps Script, click Deploy > New deployment > API Executable.
Now go to Deploy > Manage Deployments, make sure your most recent deployment is selected > scroll to the URL for API Executable > Copy.
Go to your Resources Page and create a new REST API resource. Here is where you can establish your OAUTH2 flow with Google if you scroll to the bottom.
3a. The Authorization URL and Access Token URL input boxes with the gray text still need to be typed in manually exactly how the placeholder text is shown
The last URL we copied we'll paste into base URL. Follow these steps here..
Follow this guide next.
Now you should be able to create your queries using this new resource simply by adding
function : <your apps script function name>to the body of the POST request.
This doc has the rest of the info you'll need.