Reputation: 1119
Is there a way retrieving Data from an Excel-Sheet using ADO.net and header names when the headers are not on row one?
e.g.
[1: |BLANK | BLANK | BLANK | ] < Blank row
[2: |Name | Age | Address | ] < Header row
[3: |John | Smith | Abstr. | ] < Data row
Isn't there a possibility to specify a "starting cell" ? e.g.
Range A9:EndOfFile
And would this trick resolve my problem?
Upvotes: 0
Views: 689
Reputation: 130
Perhaps you could import the dataset from Excel as if it did not have a header row, then extract the data from the desired row and use programmatically set the headers for your DataTable from that data. For the ConnectionString, you can set HDR=NO to read every row as data.
Here's a link related to Excel ConnectionStrings and the HDR setting: https://www.connectionstrings.com/excel/
Upvotes: 1