Reading an Excel File From C#

后端 未结 5 835
我寻月下人不归
我寻月下人不归 2020-12-09 23:38

I have a connection string to read an excel file from my C# project that looks like this..

String ConnectionString  = \"Provider=Microsoft.ACE.OLEDB.12.0;\"          


        
5条回答
  •  -上瘾入骨i
    2020-12-09 23:56

    I think your connection string is formatted wrong and the "Could not find installable ISAM" is usually an indication of this.

    Try this, it's from a piece of operational code I have:

    Excel 2007

    string connectionString = string.Format("Provider=Microsoft.ACE.OLEDB.12.0;Data Source={0};Extended Properties=\"Excel 12.0 Xml;HDR=No;IMEX=1\";", fullPath);
    

    Excel 2003

    string connectionString = string.Format("Provider=Microsoft.Jet.OLEDB.4.0; data source={0}; Extended Properties=\"Excel 8.0;HDR=No;IMEX=1\";", fullPath);
    

提交回复
热议问题