Get specified row count in excel using c#
<p>I have a excel template where I have 1-100 row filled just with ID, my other column name and email is empty. </p>

<pre><code>ID   Name   Email
1
2
3
.
.
100
</code></pre>

<p>here I have no data in the excel when I try to get row count I get 100, but I want to get the row count of either name or email which is filled with data, How can I do that.</p>

<pre><code>        Excel.Application xlApp;
        Excel.Workbook xlWorkBook;
        Excel.Worksheet xlWorkSheet;
        Excel.Range range;         
        xlApp = new Excel.ApplicationClass();
        xlWorkBook = xlApp.Workbooks.Open(fileName, 0, true, 5, "", "", true, Microsoft.Office.Interop.Excel.XlPlatform.xlWindows, "\t", false, false, 0, true, 1, 0);
        xlWorkSheet = (Excel.Worksheet)xlWorkBook.Worksheets.get_Item(1);
        range = xlWorkSheet.UsedRange;
        int iRowCount = xlWorkSheet.UsedRange.Rows.Count;
</code></pre>
