In excel, some column name is again repeated with same name

I need to fetch details from excel and enter into some portal.
For example,
Name Productname itemname Productname itemname
123 asd asd
abc xxx ccc xxx abc
cde yyy ddd aaa abc

In this scenario, this excel has 5 column, fetching details from here and enter into the portal.
first row is fetching it has only 3 column value and enter into portal.Now, Second row is fetching, it first enter the abc, xxx and ccc. and again it has productname and itemname value in this time they need to click add category button to expand the form and type the xxx and abc. How to check whether it has 3 column or 5 column??

1 Like

Hope we are inside the for each row loop
Before inserting the data from each row of each column inside the for each row loop we can first use a If condition to validate whether the number of values along the column like this
row.ItemArray.Length > 3
This will check whether the row has value greater than three columns and has five values in it

So the sequence be like
Excel application scope
Read range
For each row loop
If condition (where we need to use this condition)
If true it will go to THEN part where we can enter for five values or will go to ELSE part where we can enter for three columns

Cheers @Bakia_Murugesan


It will be more then 5 also , how to check whether it is repeated or not???

As we have columns we will be getting maximum of five values only right while in that case the above expression will validate that
Do we have a chance to get more than the number of columns or can we have a sample of how it would be
Cheers @Bakia_Murugesan

Here am attached the sample file,the column name(productname , itemname and quantity) is may be repeated or may not be. If it is repeated means i need to click add category button to expand the form and type the respective values. How to check??

Fine I side things for each row loop use a assign activity like this
Out_colcount = (row.ItemArray.Length -1)/3

Where Out_colcount is a int32 variable

—now use a while loop with the below expression while still being inside the for each row loop
Counter > Out_colcount
—inside the while loop we can use click activity to click on the add category
—but at last of while loop use a assign activity to increment the counter
Counter = Counter + 1

Cheers @Bakia_Murugesan

Thank you, I wil try it and let you know.
But i have one doubt same column is repeated means in uipath it throws an error to remove the duplicate column??

Yah in that case uncheck the Add Headers property in the read range and start to read the range from “A2”

Cheers @Bakia_Murugesan

1 Like (19.4 KB)
Check this… But you may need to ignore first row, because headers are ignored and first row will be considered as actual value.

1 Like