In an excel file there are 4 sheets present in it how can we find top 5values for all sheets using uipath

I need help to solve this issue.

1 Like

Hi

Hope the below steps would help you resolve this

  1. Use a excel application scope and pass the filepath as input and get the output from the same activity named out_workbook

  2. Now use a for each activity and pass out_workbook.GetSheets as input
    And change the type argument as String

  3. Inside the loop use a READ RANGE activity and get the output as dt

  4. Then use a SORT DATATABLE activity and pass dt as input

  5. Now inside the same loop use ASSIGN activity like this

dt = dt.AsEnumerable().Take(5).CopyToDatatable()

  1. Inside the same loop use a write range activity and for that search as workbook in activity panel and under that choose write range activity
    There pass filepath of new excel file and mention input as dt and enable add headers and sheetname as item.ToString

  2. And finally inside the loop use a clear datatable range activity and pass dt as input

Then this will work for all the sheet and gets you the top five rows in all sheets and write in a new excel file

Cheers @sandhyarani

1 Like

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