3

I need to read a table in an Excel file starting from 10th row (rows before 10th row are having other data and they are not in a correct format and coteins banners, cell splits, ect) using Ado.Net. How can I do that?

bruno
  • 1,830
  • 2
  • 22
  • 36
Thanushka
  • 1,395
  • 5
  • 25
  • 54

2 Answers2

3

It's all here: How To Use ADO.NET to Retrieve and Modify Records in an Excel Workbook With Visual Basic .NET. The article contains code samples for to VB.NET, but the C# code shouldn't be too difficult to deduce.

Pay particular attention to the section specifying Table Naming Conventions

Simen S
  • 3,210
  • 18
  • 24
  • Hi Simen, Thanks for replying. But is the articale the range should be fixed. And what I only know is the starting row no. I don't know the end row no or the column name. – Thanushka Apr 06 '11 at 08:59
  • It sounds like your Excel data source isn't structured in the way that I would prefer if I was embarking on implementing an interface to it. You could use Excel automation to initially evaluate the layout of the Excel sheet (http://support.microsoft.com/kb/302084) but I wouldn't really recommend going down that route. – Simen S Apr 06 '11 at 09:06
0

Thanks all for your help. Specially Simen. I've managed to find a solution for my problem with some help from this article: OleDb connection to Excel; how do I select fixed width, unbounded height?

Community
  • 1
  • 1
Thanushka
  • 1,395
  • 5
  • 25
  • 54