How to fetch no of columns in a specific row or each row. Can anyone please help on this

I am new to RPA UIPath. In selenium we can fetch the no of columns/cell in the specific row using cell iterator but how to do the same in UIPath?.

Hi
Welcome to uipath community
If we have the datatable variable named dt ready obtained from READ RANGE ACTIVITY then to count the number of columns in it
Use this in WRITELINE Activity
dt.Columns.Count.ToString

Or if we have the datarow from datatable ready inside the FIR EACH ROW loop or any where else then the expression in WRITELINE activity be like this
row.ItemArray.Count.ToString

Where to row is the variable of FOR EACH ROW activity which is given with datatable dt as input

Cheers @Vikas1681

Hi @Vikas1681,

Welcome to the community.

Use like row(0).tostring Will be column 1 cel 2
Row(2). tostring column 2 cel 1

Hi @Palaniyappan,

Thanks For replying. Actually I already tried this but didn’t got the required result. Here I am attaching my excel . Please let me know where I am doing wrong.
image

Here in the excel there are 8 rows and 2 coumns. But in the second row there are 2 cells so I want to write a logic such that for first row it should give no of cells as 1 and for next row it should give 2 then again 1.

Main.xaml (9.5 KB)
Try this and let me know if it helps.

1 Like

Thanks @SowmyaLeo. It worked. Can you please suggest some links/Videos to learn UIPath.

The UiPath Academy is the best place to start with .

https://academy.uipath.com/

As you do more and more hands-on, the forum out here will be of immense help to deepen your understanding.

Thanks @SowmyaLeo. I will start with UIPath Academy.