How to loop an excel column

Hi,
I have an Excel file which contains only one row at the moment.
I want to loop through that row and if I find Y as a value, I want to take the header text for that specific field.

How can I achieve this result, please ?

Here is an example of what I mean.

@Egzon_BERISHA
welcome to the forum

A compact approach could look like following:

Read the excel within a data table (e.g Excel Application Scope / read range) - dtData

Then use an assign activity:

arrColNames =

(From x in Enumerable.Range(0, dtData.Columns.Count)
Where dtData.Rows(0)(x).toString.Trim.Equals("Y")
Select c = dtData.Columns(x).ColumnName).toArray

Hello, thank you for the response, but I don’t see how I can implement this code in UiPath Studio, do you have any YouTube video as reference please ?

Simply use an assign activity with arrColNames in the left and the code on the right

Thank you wherry much it worked :slight_smile:

start like this:

When more video help is needed train the basics here:

What would be the code if we add another line so instead of hard coding the value 0 can we make it run for each row ?

Is it possible @ppr ?

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