Excel RowCount

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • John Barr

    #1

    Excel RowCount

    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..?
  • Nicholas Paldino [.NET/C# MVP]

    #2
    Re: Excel RowCount

    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.


    --
    - Nicholas Paldino [.NET/C# MVP]
    - nicholas.paldin o@exisconsultin g.com

    "John Barr" <jbarr@toobrand s.com> wrote in message
    news:01f801c34b 00$4b273610$a40 1280a@phx.gbl.. .[color=blue]
    > 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..?[/color]


    Comment

    Working...