Find number of rows in datatable

Hi All,

Is there a way to get a count of the number of rows in a data table, the data table is created from a read range.






I am using a read range " A2:K10" , even if there only two rows filled in this range the count comes to 9 (7.2 KB)

Hi Saivig,

If you would like to ignore empty fully empty or whitespace row this would do the trick.

row_count = dt.Rows.OfType(Of DataRow).Where(Function(r As DataRow) String.IsNullOrWhiteSpace(String.Concat(r.ItemArray).ToString) = False).Count



How does one go about identifying properties that are available for objects like tables?


Accessing the Microsoft Developer Network site is all very well if one is a programmer. As a non-programmer, the information on this site is of little or no value to me. I need information that is specifically pertinent to UiPath, not generic . I started off with a very simple requirement, establishing how to identify the number of rows (and columns) in a datatable. I couldn’t find what I needed on that site so had to search the forum, a hit and miss mechanism. Someone did volunteer Dt.Rows.Count, which isn’t revealed by a search of the site.

This is a highly inefficient way to obtain information that, imho, should exist as explicit UiPath guidance. I expect there is a large number of object properties, string operators and who knows what else that will be very valuable but “hidden” from a non-programmer. Even the Variable Types accessible from the Variables pane results in a huge generic list rather than a list that is specific to UIPath.

I have to say that my feeling at the moment is this reliance on the generic (and nonspecific) Microsoft Developer Network source is an abrogation of responsibility to either provide explicit UiPath help or to explain how to use that source. For example, Dt.Rows.Count isn’t found by a search.

When searching the forum, someone also volunteered the following:

row_count = dt.Rows.OfType(Of DataRow).Where(Function(r As DataRow) String.IsNullOrWhiteSpace(String.Concat(r.ItemArray).ToString) = False).Count

So it looks like I have a lot more programmer stuff to learn than I’d anticipated. .Count appears to be a generic operator that could be used in other circumstances. How would I know that? Where does one learn how to put that type of expression together? Is there some help or a video that explains how to build useful expressions? Is there an explicit list of useful operators, like .ToString and .Count?



Do you want something within UiPath resorces that would explain this or an external source would help. I’m asking this because you could face the situation with some other scenario as well.
Have you gone through the Academy training, although it doesn’t teach you .NET basics but atleast makes you scratch the surface. Again I agree with you regarding the Non Programmer getting the hang of UiPath coding related stuff.Someone from Uipath should be able to defend how they are dealing with Non Programmers who are trying to use UiPath. Are they expecting their customers to learn by themselves (Google ofcourse) and get their hands on UiPath?

1 Like

I’m not fussed either way, I would just like some coherent documentation that identifies all the useful functions and explains how they are used. Searching the Web is all very well but knowing what to search for, sifting the huge set of results then going through each source to try to understand what it’s trying to say is a big problem if you are not a programmer.

As a non-programmer I completely understand your frustration! A sort of UiPath guide should be given of the non-UiPath functions that can be used in UiPath. It would be much easier to learn UiPath, because now I constantly have the feeling that I’m missing the bigger picture.

This doesn’t answer the wider question about a broader reference, but as an example, I had a data table called ordersToProcess from a database query I ran, and I use Write Line with this as the text field to display the row count. → "Retrieved "+ ordersToProcess.Rows.Count.ToString + " Orders to Process..."

1 Like