For each loop : read column, regex and write, then next column

Hello

I have a working workshop so far.

I read a excel sheet on 1 cell, then regex each of the 13 elements and write to another sheet in 13 different rows.

This work perfectly.

Now i need to do the same thing for the other column.

And then start on the next row.

I am stuck on how to read the next column since i hardcode the cell i take the info from. See image :

IMAGE 1

Image 2

Any idea ?

@Nicolas_Lamoureux , is it possible to show sample excel?

Of course :

Sheet 1

Sheet 2

Hi @Nicolas_Lamoureux ,

Follow the steps:

  1. Open Excel Application Scope

  2. Give your file path

  3. Use Read Range activity. specify the sheet name if any specific name used.

  4. Save the above step output in datatable eg: dtTable

  5. Now open for each Row in Data Table and row(“columnName”).tostring

  6. Do all your above process regex and writing to another sheet.

https://forum.uipath.com/t/foreach-column/3030/4?u=adarsh_kotagiri

I feel very stupid.

See what i get

Image 3

Seems like it would be better to read the whole sheet into a datatable, manipulate the data in the datatable, then write the datatable back to the sheet. It’s a lot less reads and writes.

Hi @Nicolas_Lamoureux ,

Read your complete excel into datatable and in your For each Row in Data Table loop pass the datatable name

image

Ok, I hate to be so dense but while i totally understand your logic I still cannot make it work.
Here is the link to my project, if you could please review and point out my mistake, i would like to learn correctly.

tanxs

My Project - Xaml and all

Hi @Nicolas_Lamoureux ,

I’ve attached the sample workflow which has the basic structure. Inside the loop ass your regex condition where you want.

If anything not clear please let me know.

DeploymentFileNew.xaml (10.4 KB)

Hello,

Tanxs so much for taking the time but my question was a bit different.

The for each row get me all the row. : good

I need to read some a specific Columns, in our case, i call it Administrator.

I need to process my regex for each cell in the row 1, columns Administrator
AND THEN. move to row 2, Columns Administrator

And finaly, when i have done all the row of columns Administrator, I need to start again
but with the next columns, lets call it Administrator2 and do it all over again.

I want the robot to do it as long as he find new columns.

Maybe i dont attack the problem in the best way.

Hi @Nicolas_Lamoureux ,

Here i’ve attached the workflow to get the column name dynamically in loop. Hope it will help you.

DeploymentFileNew.xaml (11.9 KB)

1 Like

This is awesome.

I didnt know the activities Build Datatable, that is a very good thing to know.

Tanxs!

1 Like

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