Get values from column with dynamic column Name


I have to extract data from excel with dynamic columns name but it will also has 6 columns into data table (FinalDT).
After that I use FOR EACH ROW to get values every columns to another action by row(" column Name").

How can I change it if I don’t know the column name?

Please advise.

Hi @Supakinee_Navawong_na_ayu

You don’t have to give column name, it is possible through column index.
For example: if you have six columns=> Col1, Col2, Col3, Col4, Col5 & Col6 and you want to fetch the data you can provide column index
Col1= row(0).ToString
Col2= row(1).ToString
Col3= row(2).ToString
Col4= row(3).ToString
Col5= row(4).ToString
Col6= row(5).ToString

So apply this inside ForEachRow and let me know if it works.

1 Like

thank you for your help. :+1:

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