In this excel I want to get the unique rows

Hi @Gopi_Krishna1

=> Read Range Workbook
image
Output → inputDt

=> Use below syntax in Assign acitvity:

outputDt = inputDt.AsEnumerable().
           Where(Function(row) CInt(row("Amount")) > 0).
           OrderBy(Function(row) row("Names").ToString()).
           ThenBy(Function(row) CInt(row("Ticket no"))).
           CopyToDataTable()

outputDt is of DataType System.Data.DataTable()

=> Write Range Workbook outputDt back to excel.
image

FLOW:

DATATYPE:

XAML:
Sequence16.xaml (8.8 KB)

Regards

@Gopi_Krishna1

Read the data and then use remove duplicate rows activity

Cheers

Hie @Gopi_Krishna1 for this simply you have to read the data and store data as dt1 after that you can use [Remove Duplicate rows Activity] pass the input and output parameter and after that simply use write range activity
here is a screenshot hope it help…

cheers Happy Automation

Hi @Gopi_Krishna1

Use Remove Duplicate Rows Activity


Hope it helps!!
Happy Automation :uipath:

Its working fine but I need to add the amount column of both rows 6765-3233= 3532 I want like this

Hi @Gopi_Krishna1

Use the below code in Invoke Code activity:

Dim result = From row In InputDt.AsEnumerable()
             Group row By key = New With {Key .Names = row.Field(Of String)("Names"), 
                                           Key .Age = row.Field(Of Double)("Age"), 
                                           Key .ID = row.Field(Of Double)("ID"), 
                                           Key .TicketNo = row.Field(Of Double)("Ticket no")} Into Group
             Select New With {
                 .Names = key.Names,
                 .Age = key.Age,
                 .ID = key.ID,
                 .TicketNo = key.TicketNo,
                 .Amount = Group.Sum(Function(r) r.Field(Of Double)("Amount"))
             }

' Convert the result to a DataTable
outputDt = New DataTable()
outputDt.Columns.Add("Names", GetType(String))
outputDt.Columns.Add("Age", GetType(Integer))
outputDt.Columns.Add("ID", GetType(Integer))
outputDt.Columns.Add("Ticket no", GetType(Integer))
outputDt.Columns.Add("Amount", GetType(Decimal))

For Each item In result
    outputDt.Rows.Add(item.Names, item.Age, item.ID, item.TicketNo, item.Amount)
Next

Invoke Code Arguments:

Regards

1 Like