title: C# Exception thrown: 'System.Data.OleDb.OleDbException' in System.Data.dll when attempting connect to excel
body: <p>I am trying to read data from Excel in C# without office installation. </p>
  
  <p>My code</p>
  
  <pre><code>DataTable dTable;
  DataTable dTable_Fixed;
  
  string sProvider = @"Provider=Microsoft.ACE.OLEDB.12.0; Data Source= {0};Extended Properties='Excel 12.0;HDR=No;IMEX=1'";
  string sourceConstr = string.Format(sProvider.ToString(), file_name);
  
  OleDbConnection con = new OleDbConnection(sourceConstr);
  OleDbCommand oleDbCmd = new OleDbCommand();
  con.Open();
  
  DataTable dt1 = con.GetOleDbSchemaTable(OleDbSchemaGuid.Tables, null);
  
  string firstExcelSheetName = dt1.Rows[0][2].ToString();
  string query = "select * from [" + firstExcelSheetName + "]";
  OleDbDataAdapter data = new OleDbDataAdapter(query, con);
  data.TableMappings.Add("Table", "Sheet1");
  dTable = new DataTable();
  
  data.Fill(dTable);
  </code></pre>
  
  <p>The connection was not established. I am getting an error log. </p>
  
  <blockquote>
    <p>Exception thrown: 'System.Data.OleDb.OleDbException' in
    System.Data.dll 'iisexpress.exe' (CLR v4.0.30319:/LM/W3SVC/2/ROOT-1-131547875442986389): Loaded
    'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Numerics\v4.0_4.0.0.0__b77a5c561934e089\System.Numerics.dll'.
    Skipped loading symbols. Module is optimized and the debugger option
    'Just My Code' is enabled. Application Insights Telemetry
    (unconfigured):
    {"name":"Microsoft.ApplicationInsights.Dev..,"ai.operation.name":"POST
    FileDownload"},"data":{"baseType":"RequestData","baseData":{"ver":2,"id":"9AAlQXMsrt4=","name":"POST
    FileDownload","duration":"00:00:06.9290000","success":false,"responseCode":"500","url":"<a href="http://localhost:52087/api/FileDownload?Company_ID=CO_2005" rel="nofollow noreferrer">http://localhost:52087/api/FileDownload?Company_ID=CO_2005</a>","properties":{"DeveloperMode":"true"}}}}
    The thread 0x3de0 has exited with code 0 (0x0). The program '[19508]
    chrome.exe: WebKit' has exited with code -1 (0xffffffff). The program
    '[15740] iisexpress.exe' has exited with code -1 (0xffffffff).</p>
  </blockquote>
  
  <p>Am I missing anything?</p>