Going to the next column in Excel if the column before it has values

I have a really quick question. In Excel, I know for rows we can use a counter in order to populate the next cell below, in a sense. I was wondering if there is a way to do it for columns. For example, I would populate the A column in Excel and I would like the process to loop through the process and populate the B column, then the C column, and so on. Is there any way to go about this? Thanks!

For each row in dt
     For each col in dt.Columns
          Assign row(col) = “someValue”

To add onto what @alin.c.mihalea shows, you don’t have nest it in a for each row loop, unless you want to go down each row and each column. If you want to do only the columns (for example to change the title of the column, or to change only one specific row’s columns) then you can just start at the 2nd line of his code

So in a way, if I had a process that extracts one column of data and I had to repeat that process but every repetition means I have to go to the next column, I can start on the 2nd line of @alin.c.mihalea’s code?

Correct. You’d use the ‘for each’ activity and change the TypeArgument to be System.Data.DataColumn. The input would be YourDataTable.Columns

It would like like: For each item in YourDataTable.Columns - you could change “item” to “col”, or just keep it whatever you want - this is just a temporary variable used in your loop of the same variable type you mentioned in the ‘TypeArgument’ property.

This would loop through each column that you had in YourDataTable. Then you can do any processing activities within that for each activity