Loop through a set of columns of a datatable

how do I loop through part of the columns in a datatable to get the value of the item.
I have a datatable with say 20 rows and 20 columns
using for each row I loop though the rows
trying to use a for each for the specific columns I can’t figure it out.
like something like for each CurrentItem in CurrentRow.columns({8:14})

Hi,

There are several ways to achieve it.
if you want to access it by column number, the following will help you.

Regards,

different approach, I think that’ll work. Thanks.
I take it that means you can’t actually loop through a selection of the columns as is the way you loop through the rows.

thanks, Yoichi.

Hi @Luke69,

You can loop through columns. Try the below steps:

  • Use a For Each activity
  • Set Argument Type to System.Data.DataColumn
  • Set: Item name to dt.Columns (dt → Your datatable name)

Thanks