I’m just starting on my RPA journey and could use some assistance. I need to obtain a row count based on the last cell in a particular column that has data. I know there are various activities I can use for this, but a bit stuck on the argument to use. Any help would be greatly appreciated.
after reading your excel and getting itself into a datatable variable,
you can get the rowcount with the following query
dtVar.AsEnumerable().Select(Function(x) x("YourColumnName").ToString().Trim()).ToArray().Where(Function(y) Not String.IsNullOrEmpty(y)).ToArray().Count
Thank you! For “Your Column Name” can I put A or do I need to use the Region title? I was concerned that I may receive an error since the Region is not on the first row.
your rowcount variable should be of type Int32 or else add a .ToString() to the code i shared like this
dtVar.AsEnumerable().Select(Function(x) x("YourColumnName").ToString().Trim()).ToArray().Where(Function(y) Not String.IsNullOrEmpty(y)).ToArray().Count.ToString()