How to loop through columns and get value from row?

Hello everyone!
I have one excel sheet where i have more than 50 columns. I used read ranged activity and get data in DataTable. Now I need to loop through each columns and manipulate row 16 value for each column. How can i do that ?

Thanks in advance

@prabin_chand1

Use for each activity with in argument as dt.Columns

And change type argument to datacolumn if it is old for loop in latest it automatically picks up

Dt.Rows(15)(currentitem.ColumnName) will give eqch column in 16th row

Cheers

Use Dt.Columns for the same.

If you already know which value you need to manipulate then use:

Dt.Rows(Rows).Items(Column Name)

now i want to save manipulated data as new data table .
how to do this ?

@prabin_chand1

You mean only that row?

if so then after modification use newdt = dt.AsEnumerable.Skip(15).Take(1).CopyToDataTable

cheers

i want all data table to be save,

@prabin_chand1

Then just use the same or create a copy


newdt = dt.Clone
newdt = dt.Copy

cheers

like what I am doing is :
Loop through each column and maipulate row number 14 of each columns, if all columns are completed then i want to save that manipulated data as new data table.

@prabin_chand1

here dt is what you are looping and changing and after change dt is being copied to newdt as needed

cheers

thank you so much

1 Like

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