In C# i need to read the Excel File using Interop.
I am using : using Excel = Microsoft.Office.Interop.Excel;
And i am able to read data from Excel File.

Problem is in my Sample Excel File there are only 6 rows and it also reading more than six rows.
It giving row count 1702 and actual count is 6
How i can i avoid the same.

It really depends on how you are reading and recognizing when you are finished reading.

It sounds like some of your cells are not "purely" empty. ...like they previously had data but it was cleared rather than being deleted.

One technique :
If you scan the first column all as strings and trim the results and check for string.IsNullOrEmpty(), you can determine where the last good row of data resides.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.