Excel RowCount

J

John Barr

I am using C# to import data from an Excel File, and
trying only want to get a rowcount of rows with data in
them, not 65536. Is there a way to do this, or do I need
to cycle through all the rows to determine if data
exists..?
 
N

Nicholas Paldino [.NET/C# MVP]

John,

I think that what you want to do is check the UsedRange property for the
Worksheet that you are looking at. Granted, you will have to make sure you
don't double-count rows, as the range that is returned to you can have
multiple ranges in it with rows overlapping. This should work for you
though.

Hope this helps.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top