How To Count Rows In DataTable — In UiPath

While working with Excel, sometimes it’s necessary to find the number of records available in it.

Let’s see how to do that!!!

total_Count = my_DataTable.Rows.Count

Note:
my_DataTable : The DataTable you are working with

Example

Implementation using UiPath :

Let us implement a workflow to count the total number of rows in Excel.

Step 1:
Drag “Excel Application Scope” activity into the designer panel and supply the “File Path” to it.
(Sample file has been attached in the link provided at the article’s end)

Step 2:
Drag “Read Range” activity to read the Excel data and pass the mandatory fields to it like “Sheet Name” and output DataTable variable

image

Step 3:
Drag “Message Box” activity to display the rows count.

Step 4:
Now, run the code !!!

image

I hope you enjoyed the article!!

Happy Automation!!