Copy Paste Slide a certain number of times

I have an Excel file - I would like the bot to count the number of rows in the file - then run the ‘Copy Paste Slide’ in the PowerPoint package (UiPath.Presentations.Activities) activity that many times

Is this possible to do?

Hi

I would like to understand how ur going to combine these process or are they separate process
But for now
To get the number of rows, first read that excel file using READ RANGE activity and get the output as a datatable named dt

To get row count

Int_count = dt.Rows.Count

To do that much number of time u can use copy paste within a loop like While loop with a counter variable
Where counter is a variable of type int32 with default value as 0

Condition would be

Counter < int_count

On copy pasting in power point u can do with this
Activity

https://docs.uipath.com/activities/other/latest/productivity/copy-paste-slide

Cheers @E.T.S

Hi @E.T.S

Here are the steps to do this:

  1. Read the Excel File:
  • Use the “Excel Application Scope” activity to open and read your Excel file.
  • Use the “Read Range” activity to read the data from your Excel sheet into a DataTable variable.
  1. Count the Rows:
  • Use the DataTable.Rows.Count property to get the count of rows in your DataTable. Store this count in a variable, e.g., rowCount.
  1. Use a For Each Loop:
  • Add a “For Each” loop activity to your workflow.
  • Set the loop’s range to be from 1 to rowCount (the number of rows in your Excel file).
  1. Copy and Paste Slide:
  • Inside the loop, use the “Copy Paste Slide” activity from the PowerPoint package to copy and paste a slide in your PowerPoint presentation.
  • Configure the activity as needed, specifying the source and destination slides.
  1. Repeat for Each Row:
  • The loop will execute the “Copy Paste Slide” activity as many times as there are rows in your Excel file.

Make sure to configure the “Copy Paste Slide” activity inside the loop with the appropriate source and destination slides based on your PowerPoint presentation structure.

Thanks!!

@E.T.S

Inside use excel file activity use Excel.Sheet("SheetName").RowCount will give the count of rows

Or read the data using read range and then use dt.RowsCount

Then use the saved variable in for loop with Enumerable.Range(0,count)

Inside loop use copy/paste slide activity as needed

Cheers

Hi @Nitya1

I am trying to avoid using a for each loop as I have one already

Hi @Anil_G

I am trying to avoid using a for each loop as I have one already

@E.T.S

If you need to copy paste n number of times then you need to use for loop…

Cheers

I have used this and it gives the correct number of rows but when I use Counter < int_count it executes the copy and paste continously - where do I set what the Counter variable is as currently I have made the variable but it doesn’t have a value

Counter variable:

int_Count variable:

Do while:

@E.T.S

In while loop properties you have max loop count just give the count there and give condition as true it would work till max loop is readched

cheers

Hello @E.T.S

  1. Open Excel file using Excel Application Scope.
  2. Read Excel data into a DataTable and count rows (store in a variable).
  3. Use a For Each loop to iterate the same number of times as the row count.
    a. Inside the loop, use Copy Paste Slide to perform PowerPoint operations.
  4. Close Excel Application Scope.

Thanks & Cheers!!!