Loop through columns

loop through in the columns like

A, B, C, D,… AA, AB,AC,… BB,BC

How to achieve this through logic?

in datatable or Excel?



for each - typeargument set to DataColumn - Expression YourDataTableVar.Columns

with LINQ e.g. getting all Colnames: YourDataTableVar.Columns.Cast(Of DataColumn).Select(Function ( c ) c.ColumnName).toArray

1 Like

I mean like…

I am using read cell activities,
Looping through rows are like A1, A2, A3 …A100
meanwhile, how to do that with columns , which will be like this,
A1, B1,C1…AA1,AB1

I am not sure If I got you right:
YourDataTable.Columns(ColIndexOrColumnName) let you access the a particular Column

@Sweety_Girl I don’t think these are present in Datatable :sweat_smile: , You might be again referring to the Column Reference in the Excel

Hi @Sweety_Girl

I have one mini bot created which can go through the columns beyond Z to AA AB… and so on

Input for my bot was as below. Reading from column B to AE

Logic for the same is as below :-

Within ForEachRow Activity :-

Within ForEach Activity for Columns :-


If it goes beyond Z column then :-


Mark as solution and like it if this helps you :slight_smile:

Happy Automation :raised_hands:

Best Regards
Er Pratik Wavhal :robot::man_technologist:t4: :computer:

1 Like

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