[英]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? 当标题不在第一行时,是否可以使用ADO.net和标题名称从Excel表格中检索数据?
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 范围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. 也许您可以从Excel导入数据集,就像它没有标题行一样,然后从所需的行中提取数据,并以编程方式使用该数据集为DataTable设置标题。 For the ConnectionString, you can set HDR=NO to read every row as data.
对于ConnectionString,可以将HDR = NO设置为读取每一行作为数据。
Here's a link related to Excel ConnectionStrings and the HDR setting: https://www.connectionstrings.com/excel/ 这是与Excel ConnectionStrings和HDR设置相关的链接: https : //www.connectionstrings.com/excel/
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.