Use Google Run Script Activity

HI Team,

I am using google run script and i am trying to run script using Run script activity from where i can get scriptid and function name

UiPath screenshot
image

Google script code (below code is running when i am running from browser same code need to run form UiPath studio)

@Naveen_Chaganti

can you please show the error you are getting

cheers

Run Script: Request contains an invalid argument. [400]

Script id - i have given google sheet id

@Naveen_Chaganti

It is not the google sheet ID but the scriptID

It is generally present in the project propertiees

cheers

1 Like

Hi @marian.platonov

Thank you for the details, i have done as per your suggestion now getting below error

Run Script: The caller does not have permission [403]

I am using below code to update in google slide based on google sheet data

const PRESENTATION_ID = ‘18hVQEWvyfXP-8a1cQqxDdyLx-rJUozrCRK8lSnYxZFo’;

function generatePresentationData() {
let sheet = SpreadsheetApp.getActiveSheet();
let marketData = getDataFromSheet_(sheet);
let slides = getSlides_();

writeDataToPlayerSlide_(slides, marketData);
}

function getDataFromSheet_(sheet) {
let dataRange = sheet.getDataRange();
let data = dataRange.getValues();
data.shift();
return data;
}

function getSlides_() {
let presentation = SlidesApp.openById(PRESENTATION_ID);
return presentation.getSlides();
}

function writeDataToPlayerSlide_(slides, marketData) {
let slidesPlayers = slides[2];

if (slidesPlayers) {
for (let index = 0; index < marketData.length; index++) {
const namePlaceholder = ‘{{name’ + index + ‘}}’;
const q1Placeholder = ‘{{q1_’ + index + ‘}}’;

  slidesPlayers.replaceAllText(namePlaceholder, marketData[index][0]);
  slidesPlayers.replaceAllText(q1Placeholder, marketData[index][1]);
}

} else {
console.error(‘Slides array does not have a valid second slide.’);
}
}

  • It seems that the robot user is not having access to run the script. Check if the below helped you.


  • Try to use the service account for authentication.

  • Google requires that all Google projects have unique names. This error message indicates that by creating a sheet project with a name that matches a currently existing Google project, you are trying to perform an action on a Google project that already exists for which sheet does not have permission, which is why you see messages like The caller does not have permission and PERMISSION_DENIED.

HI @marian.platonov

Is it possible to extract data from Google Slides using UiPath, identify the row index within a table on a specific slide, and then update the content in certain rows?

Suppose you have a presentation with three slides, and on one of those slides, there is a table with a header named “testing.” You want to access this table and modify the data within specific rows.

In the UiPath Google Workspace package, there are no Google Slides activities at this moment.

image

Reference: https://docs.uipath.com/activities/other/latest/productivity/google-workspace-cross-platform-activities

Until this feature will be present in UiPath Google Workspace package, you can check the Google Documentation for Slides and to build your own App Script/Python to manipulate the Slides.

Examples:


In conclusion:

Yes, it is possible to extract data from Google Slides using UiPath. However, this usually requires interfacing with Google Slides’ API to extract such data or using screen scraping methods to capture the on-screen data.

Despite this, UiPath does not provide direct activities to manipulate Google Slides data. Yet, it does provide activity to manipulate Google Sheet data. Your requirement of identifying the row index within a table on a specific slide and updating the content specifically can be a bit challenging.

One potential workaround could be to use a combination of Google’s own “Apps Script” to interface with Slides, extract the data you need, and then use UiPath’s HTTP Request activity to interact with your Apps Script.

To be precise, if you often need to deal with tables in presentations and update them, it could be better to maintain the data in Google Sheets, and then just insert linked tables into your slides. This way, when you update the data in Sheets, it would be updated automatically in your Slides. But handling such operations on Google Slides directly might not be feasible directly via UiPath.

Remember that using UiPath for screen capture or scraping methods may not be reliable in all scenarios since it will rely heavily on the format and presentability of the data on the Google Slides. It would be better if the data could be first processed in a spreadsheet or a database, and then presented on Google Slides.

Remember: Whatever approach you select, you will have to build and test it thoroughly to ensure it works consistently.

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.