GSuite App Script - Run Script activity giving error - Requested entity was not found. [404]

I want to use App Scripts activities from GSuite. I have been able to use all the activities, but I am facing problem with run script activity. I am not able to execute the script from UiPath Studio.

Steps followed

  1. Created a Project - Using Create Script Project Activity
  2. Uploaded the Script file “*.gs” - using Upload Script File Activity
  3. Deployed the script - using Create Deployment activity
  4. Run the Script - using Run Script Activity

Steps 1 to 3 are running fine and i have also checked in my google projects, the projects are being created. but only the last step is always giving me an error. I can run the same uploaded script manually from the google project page (https://script.google.com/)
Below is my workflow followed by the error


image

1 Like

Hi @botBotGo,

Sorry for the late answer, have been really busy!

The reason why the script is returning not found is because there is a middle intermediary step in between publishing the project and being able to run it.
In short, when you create a new script a new gcp project is created along-side it. For you to be able to run, you need to manually switch the associated project of the script (there is no way to do this using the api, i also faced the same problem when developing and testing apps script).
Here is the official documentation explaining what to do:

As you can see, it links to this: Google Cloud Platform Projects  |  Apps Script  |  Google Developers

The second link details what you need to do.

1 Like

Hi @Mihai_Dunareanu and @botBotGo

I’ve been trying to run a apps script in UiPath, but getting the exactly same error mentioned above. I went through the documentation @Mihai_Dunareanu has mentioned, but didn’t help.
I have performed below steps:

  1. Created a project in GCP. Gave OAuth credentials to it.
  2. Wrote Apps script, deployed it using new deployment and type ‘API executable’.
  3. Copied the project number from Project dashboard page and entered it in Apps script project settings page.
  4. Called the ‘Run Script’ activity (directly) in GSuite Application scope. Provided all required scopes and provided Script ID (found in project settings page of Apps Script) and function name.

I get the same error over there. (Requested entity not found)
Have I missed some step?

Hi @rajatjoshi ,

This works in my end using the deployment id of the script instead of the script id. It is located on Deploy>Manage Deployments

1 Like

Hi @Emman_Pelayo

Thanks for the answer!
Did you use this deployment ID in the ‘Script ID’ property of the UiPath activity?
Also, are you using OAuth or Service account for the Google API?

Yes. Use the deployment ID on the script id property. Im using Oauth on this. I tried using service account but for some reason it throws error (same setup with Oauth tho :neutral_face:)

I guess, Google API doesn’t allow using Apps Script via Service account. Read the documentation here: Executing Functions using the Apps Script API  |  Google Developers

However, there must be some way, I believe, to make this happen.