How can get column Name from DataTable by activity For Each Row

I need some helps for my job.
I have datatable(XX) from excel file , There are many columns but some of them starts with “img” ex. img_width ,img_length

How I get values from column that start with “img” by using For each row activity

Thank you in advance

@Supakinee_Navawong_na_ayu Can you tell us in more detail about the scenario, maybe you can provide us with Input File or Screenshots, Tell us the operation that you want to do and the expected output that you want to get. In this way we can suggest a better solution.

You can get a DatatableCollumn Collection using a assign of value datable.Collumns.
After that ou has a lot of ways to proceed, you can get all Collumns that start with “img” using Linq on that collection, or going row by row (using a For Each) and doing the check.

I recommend you to give a look in:

If I remember well, there’s a library in Connect, made by our lord and savior @balareva that can help you getting that and other things on a Datatable:

2 Likes

This is excel that the source of datatable .

I need value of column start with “img” (column F- I)
Thank you

I need value of column start with “img” (column F- I)
Thank you

@Supakinee_Navawong_na_ayu Can you check this example workflow :
Read Range.zip (7.5 KB)

It uses the DefaultView.ToTable method to keep all the required Columns that you need. Check if is the required output and revert back if it is not working.

Your suggestion is work. But I have to read row by row of excel and keep value of column start with “img_”

I use activities “For each row” for control.
I use your logics the result is incorrect.
DT2 should has only 1 record.

Please advise.

@Supakinee_Navawong_na_ayu What is the output that you get now ?

Input is

Ouput is

Output should be only record 1,3,4,5,6,7,8,9,10

@Supakinee_Navawong_na_ayu Is it that you need it to be only those records because you only need the first row data and not all of them ?