How i can get alternative values from excel like row 1 and row 3 odd row except even row

how i can get alternative values from excel like row 1 and row 3 odd row except even row

1 Like

Hi @sayed.tabrez,

Could you please elaborate your problem?

I Had excel sheet which value nearly 50
i want only odd row values not the even row values

Hi @sayed.tabrez,

Use assign:
odd_dt = dt.AsEnumerable.Where(Function(x) Not dt.Rows.IndexOf(x) Mod 2=0).CopyToDataTable

where dt is your output datatable used in Read Range.

Please mark this as solution if it solves your problem.

2 Likes

I think it will be easy to copy excel into a data table and then process.

After that use a int variable and assign value 1 and use “For Each row in data table”. Put IF condition inside the loop and where you process on odd numbers and nothing on even.

dt.asenumerable.skip(2).Tostring.copytodatatable

one of friend suggest me this
is this correct?

Nope!

This will skip only first 2 rows of your datatable.

You can use the above solution I have mentioned, either you can get a separate odd_dt using Enumerable or you can put that condition inside your for each row in datatable.

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