How to select random rows from an excel file and copy over to another excel file


I am trying to select random rows from an excel document (e.g. 100 rows i need 30 random rows) and copy it over to another excel file. Currently i am trying AsEmunerable but it only gives me the first 30 rows.

Is there anything wrong with this or is there any alternative solutions.

As an alternate you can create a list of Index numbers like this

With the distinct we do run till we got 30 unique index values.

The rows can be selected with: RandomList.Select(Function (x) DataTableVar.Rows(x)).CopytoDataTable

1 Like


Do you have the workflow?

Thanks alot for the help!

Find starter help for generating the random Index numbers here:
Needhelp.xaml (6.0 KB)


Give this a try: (29.7 KB)