I’m fairly new to UiPath and I’m trying to get the Total Number of Rows from an excel file as well as the number of Unique Values in a certain column. I then have to insert these values into an email.
So, per my screen shot below There are 25 Total Records, 16 are Commercial and 9 are Retail.
Note : here I am creating a datatable which would be having category name on column and their count in other column. the last row in that datatable would be having total count of datatable rows
Try this
Create a datatable with 2 columns Name and Value store in a variable dt1
Read the excel file and store in a variable dt2
Now use below assign activity
dt1 = (From row in dt2.AsEnumerable
Group row by k1= row(0).ToString Into Group
Select dt1.Rows.Add({k1,Group.Count})). CopyToDataTable
Add a data row to dt1 with values {“Total”,dt2.Rows.Count}
Now u will get a dt1 datatable having values of individual category and total values at last row
Oh, Okay now I get what you are saying with the total.RowCount, etc.
So, I’m trying to put those values into my email but I’m getting an error in my email. Send Email: Object reference not set to an instance of an object.
Add 3 log messages before send mail and in each write each of the rowcount…then we can see what is empty…basically the error says that some variable value is null…is the range H:H correct?