How to count the filled rows in excel, i tried with read range activity but it gives total count instead of total filled rows count?

How to count the filled rows in excel, i tried with read range activity but it gives total count instead of total filled rows count?

Hi @shashank

To count the rows:

  1. Read Range (dtInput)
  2. Assign intRowCount = dtInput.Rows.Count
3 Likes

thanks for your response, as i already mentioned i tried with this but i want only rows that has some value i.e. only filled rows count i need. by trying “dtInput.Rows.Count” i’m getting the whole count.

Use select query and try

dtInput.Select(“Query condition”).count

If you want to get it as datatable back then
dtInput.Select(“Query condition”).CopyToDataTable.

What is the condition you are looking for?

1 Like

If you can show a sample excel file.
Because we can use Filter Data Table first before counting the rows :slight_smile:

2 Likes

i want only filled rows(not blank or empty one) that is the only condition. sorry i can’t share the sample files of that.

1 Like

You can use this, If you are unable to get it check with keywords to write select query online

dtInput.Select(“[Column Name] isNot ‘"+String.Empty+"’ or [Column Name] isNot ‘’ or [Column Name] isNot NULL ”).count

It seems " isNot " is not working, because it is throwing error.
my problem is very simple → only i want total filled row count.

use filter data table activity and filter rows that are not empty and find count

Will you pls tell me the command for filtering rows that are not empty and find count suppose column name is “COL 1”

Use Read Range
then Filter Data Table
In that use condition for one column as
"Column Name" = ""
Select Remove Opt
And Store them in Dt Variable as Output

After that use assign activity in that use dt.rows.count