[SOLVED] How to Count the number of rows of actual data in a read range that looks at an entire column

Hey Guys,

I’m trying to find the actual number of rows with data in it in an excel file when reading the whole column (ex: “J:J”). I understand the that I can set the read range, but the file I’m using will always be changing the number of rows based earlier processes so it’s necessary not to set the read range, because I don’t know what it’s going to be. I’ve tried using datatable.rows.count, but that only gives me the number of rows (1048575) blank or populated in column J.

I want use that value to meet the Do While condition later in my process

Needing a little help on this one guys…thanks!

If you leave the Range property blank in Read Range activity, it will read all the used rows. You dont have to bother about the number of used rows at any given time.

Indeed. When you need the number still and when your using a If statement than you can use a counter. _(To)_Counter = _(Enter a VB…)_Counter + 1 in the “Assign” activity.

I have multiple columns of data and I want to only read one column. How to I specify that column? I’m assuming I use the readrange activity and leave it blank, assign a variable the datatable.rows.count and then add another readrange activity and assign that variable to the range (with hard coded text)

Your approach is what I would think of too. If the only way is to get the number of rows.

Alternatively, You can still read all the columns and use only one. Wouldn’t make a difference unless you have tooooo many columns. You can also use Remove Data Column activity on a data table to remove any column that you really dont want to have in the data table (in cases like writing the datatable as an output)

@kaderms thank you for the help sir! Sometimes we all need someone to think things through with; I appreciate it!

2 Likes

That’s why I love the forum. Connects all the great minds! :slight_smile:

1 Like

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.