c# - 是否可以通过没有标题行的 ADO.NET 访问 Excel 文件?

标签 c# excel ado.net

我有一个格式化的 Excel 文件,我无法控制它,我需要阅读其中包含的信息。

该文件的问题是前几行包含格式化信息,我无法修改该文件,也无法要求更改格式。

那么,是否有可能通过 ADO.Net 读取这样的文件?

提前致谢,

最佳答案

我认为这篇文章解释了如何很好地做到这一点:
http://support.microsoft.com/kb/316934

至于缺少标题行...

With Excel workbooks, the first row in a range is the header row (or field names) by default. If the first range does not contain headers, you can specify HDR=NO in the extended properties in your connection string. If you specify HDR=NO in the connection string, the Jet OLE DB provider automatically names the fields for you (F1 represents the first field, F2 represents the second field, and so on).

关于c# - 是否可以通过没有标题行的 ADO.NET 访问 Excel 文件?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1646691/

相关文章:

c# - 获取并格式化与 NodaTime ZonedDateTime 值对应的 UTC 时间?

c# - 什么作为 Web 引用 (ASMX) 应该作为服务引用 (WCF),对吗?

Excel 柱形图数据在表格中但不在图表中

C# 数据库中的多个并行插入

c# - 通过 ADO.NET 调用存储过程来填充 List<int> 的最有效方法

c# - Visual Studio MySQL 数据集错误

c# - 如果本地(但未使用)变量是对对象的唯一强引用,那么符合标准的 C# 编译器能否优化掉它?

vba - 在 VBA 中处理一个集合的嵌套 For 循环

python - 在 pandas 列标题上方插入一行以将标题名称保存在 csv/excel 文件的第一个单元格中

nhibernate - Entity Framework 2 和 NHibernate 相比如何?