我有一个格式化的 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/