Run a script (Google App Script) using RPA

Hello everyone,

Is it possible tu run a script (from Google App Script) using an activitie/API ?

The only way I found is to open my spreadsheet, and use a Click activity to run my script (or to parametrize an onOpen trigger). But it’s not the most robust way to do it…

I looked for a solution inside the forum but I didn’t find anything about this,

Thank you for your help !

Hello everyone,

I saw in the documentation that now some activities are availalable to use Google App Script. But, they didn’t aprear in my studio. I have the version 2019.4.4 and all my packages are udated. Moreover, I am used to develop with other Google activities without any problem.

Thank you for you help :slight_smile:

hello Matthieu, I am using the 2020.4.3 version of studio and its available for me. So i would suggest you to update your Studio to this version. But anyways, I have been using all the gsuite activities and they all seem to work. But the run script activity in Apps Scripts is always giving me an error. Below is the workflow i am using, followed by the error.


image

Hi ! Thank you for your answer, I have now the activity. But unfortunately, I have the same Error Message …

Matthieu

We face the same issue. I am looking forward for a useful hint.

Hi,

It works on my end using the deployment id of the script instead of the script id.

Thank you @Emman_Pelayo.

In fact, it works for me now. What I had to do is to link my script with my GCP, and then publish my script as an Executable API.

In this way, I can run my script from the studio : with a run script, inside a google application scope used with Oauth credentials.

The last thing to do is to connect to Google Account to generate a token (the Oauth page is opening the first time you want to run your script).

Matthieu

1 Like

Nice one! problem with Oauth credentials tho is that it shows oauth consent screen. I think the token has an expiration so you may want to check on it maybe.

The other option to eliminate the oauth consent screen is by using service account credentials. Tho it seems that appscript is not supported using service account :3.

Hi @MatthieuRotaru and @Emman_Pelayo

I have done exactly as you mentioned - wrote script, deployed it with API executable (with access to ‘Anyone with Google Account’), added GCP, Create OAuth, Called ‘Run Script’ activity inside a scope with OAuth credentials and gave required scopes to it. However, I’m getting an error - “the caller does not have permission”. Did you encounter this? Have I missed any step?

Can you try unchecking domainwideaccess property?

I figured out the issue. In GSuite Application Scope’s properties, I had selected OAthClient as ‘UiPath’, which should have been ‘Custom’.

Worked.