简体   繁体   中英

Getting Data from Excel Sheet using ADO.NET w/o Header in first row

Is there a way retrieving Data from an Excel-Sheet using ADO.net and header names when the headers are not on row one?

eg

[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" ? eg

Range A9:EndOfFile

And would this trick resolve my problem?

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/

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM