How start a for each from an specidif index of a data table

Hi there!

I have a table in excel, which I have to separate into 2 parts, the delimiter is a word that is captured in a row (at this point is written on a separate page the content before this delimiter)

I would like to know how I can continue the route of the for each from the point where I am staying.

I have read that I can use a while for this purpose, but I would like to know if someone has an example of how the structure of the for each should go with the while

Hi @AS_Deloen

Welcome to the comnunity
cheers!

You need to use break in order for you to make itteration in the next table.

Hope this might help you…
cheers

Hi ,

There are multiple ways through which you can do

  1. First ,
    You can find the row index of the the specific word using the below expression

rowIndex =(datatableVariable.Rows.IndexOf(datatableVariable.AsEnumerable().Where(Function(row) row(0).ToString.Contains(“word”)).ToArray()(0))+1).ToString

the other way of doing the above is ,

use for each to iterate and initiate a counter to 0 ,

convert the row into string by using the below expression

string = String.join(",",Row.itemArray)

check if the particular string contains the value , if it contains take the counter as rowindex
else increment the counter .

  1. once u find the index , u can pass it in the below expression
    datatable 2 = datatable.skip(rowindex).copytoDatatable .

This expression will skip it to that point and put the remaining in the other data table.

regards
Vishnuvarthan

Hi,
can you please suggest me the approach on my below query.
I have written contains string check and int_index is populating correct and copied to data table but I want to read Index Ex: 9 from 50 and want to skip remaining records to be copied.
I have checkpoint in file with String “End” at 50th line of my file . as per below line it is giving all lines from Index 9 to end of the excel. please let me know how can we copy from 9 to 50 in my example.
dtInput.AsEnumerable().Skip(int_index).CopyToDatatable().
Please suggest .