Is it possible to group rows based on email id and copy to separate workbook?

The email ids i get each day is dynamic and i have to segregate rows based on email id and copy to separate workbooks.

please help

1 Like

Hi
Yah that’s possible
We can filter while getting the mail from get outlook mail activity itself with Either using
“[From]=‘Username’ “
Or
“[SenderEmailAddress] =‘xxxx@gmail.com’ “
In the filter property of get outlook mail activity property panel

Or

Once after getting the rows in a datatable
We can filter it with
Either with FILTER DATATABLE ACTIVITY or SELECT METHOD
In filter datatable activity pass the input datatable and get the output with a datatable variable
—inside pass the columnname with double quotes in column field and mention the condition and pass the value with email id between double quotes
For more details on that

https://docs.uipath.com/activities/docs/filter-data-table

Or with select method
Yourdatatable = Yourdatatable.Select(“[yourcolumnname] = ‘youremailid’ “).CopyToDatatable()

Or if with variable then

Yourdatatable = Yourdatatable.Select(“[yourcolumnname] = ‘ “ + yourvariableName.ToString + “ ’ “).CopyToDatatable()

Simple isn’t it @Tiji_Johny

Kindly try this and let know for any queries or clarification
Cheers @Tiji_Johny

@Tiji_Johny

Yes its possible.

  1. Use Read Range activity to read excel data and store output in dataTable say ‘DT’.

  2. Then try below select query to filter data.

          newDT = DT.Select("[ColumnName] = '"+emailVariable.ToString+"'").CopyToDataTable
    
  3. And then use Write Range activity to write resultant data into excel file and pass “newDT”.

Hi @lakshman

Thanks for the reply.

The email ids i receive each day is different , i need to copy

  1. row with distinct email id in separate workbooks(separate workbook for each distinct id) and
  2. rows with same email ids in separate workbook.
1 Like

@Tiji_Johny

If you want to find the distinct email ID rows then try below expression.

              distinctRowsDT = DT.Default view.ToTable(True,"EmailColumn").CopyToDataTable

sample.xlsx (11.4 KB)

Hi @lakshman

Can you please check the sample sheet attached.
As out put i need 3 separate workbook

  1. Brian Francis
  2. Adam Smith
  3. Adam Griffiths

would it be better to filter by name than email id