How to extract odd and even numbers from excel sheet and write it new excel sheet

image
how to remove all the even and odd numbers?
How can I do this? Someone please help to achieve this.

@manjusree_R_N_manju

Welcome to forums

Can you share what output you want?

Thanks

i want to write even numbers data in one excel sheet and odd number data in one excel and send the data through two separate emails

@manjusree_R_N_manju

Use Read Range activity->which output your excel sheet as Datatable, Eg: DtSheet

Now Create Evendt and Odddt variables as System.Data.DataTable Type

Now use Assign and write as below

EvenDt = DtSheet.AsEnumerable().Where(function(x) Cdbl(x(“Register No”)) Mod 2 = 0).ToList.CopyToDatatable

OddDt = DtSheet.AsEnumerable().Where(function(x) Cdbl(x(“Register No”)) Mod 2 <> 0).ToList.CopyToDatatable

Check below for your reference

Use Write Range activity to and write in the sheets by using the datatables

Hope this may help you

Thanks

1 Like

@Srini84
Thank you it’s working much appreciated your support.

Can u please explain me this, it would be very helpful: DtSheet.AsEnumerable().Where(function(x) Cdbl(x(“Register No”)) Mod 2 = 0).ToList.CopyToDatatable

@manjusree_R_N_manju

It’s a linq function where It will filter the value of Register No Mod 2 = 0

For Mod to understand, Please refer below

Mark as solution if this helps you

Thanks

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