How to iterate through rows in Data table?

I have a DT and I am using “For each row in data table” to iterate through it
In type into activity, I’m using

Currentrow(“ColumnName”).ToString

But my question is How can i Iterate through rows, when I use

CurrentRow.ToString
it is giving output “System.data.datatable”

Hi @Sami_Rajput you can write

CurrentRow(“ColumnName”).ToString OR CurrentRow.Item(“ColumnName”).ToString not only CurrentRow.Tostring

Hi @Sami_Rajput,

use below method in loop

String.Join(“,”,CurrentRow.ItemArray)

Thanks,
Rajkumar

Hi @Sami_Rajput

You can try with + to combine the columns

Currentrow(“ColumnName 1”).ToString+ Currentrow(“ColumnName2”).ToString

String.join(“ ”, Currentrow.itemarray)

Regards
Gokul

@Gokul001
sample.xlsx (8.6 KB)
Can you please make it work for this sample??
Because through your code it is treating all the columns as a single row

(I want to iterate through rows but one by one)

@Sami_Rajput write the code like this:

1 Like

That’s what For Each Row in Datatable does.

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