title: Import data from excel in c#
body: <p>I am importing data from excel sheet to my sql server database in c#.And below is my connection string for that -</p>
  
  <pre><code>var OleDbcon = new OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" + path + ";Extended Properties=Excel 12.0;");
  </code></pre>
  
  <p>But this is not working on machines where MS Office is not installed.</p>
  
  <p>And for this issue I have changed my connection string like this :</p>
  
  <pre><code>var OleDbcon = new OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + path + ";Extended Properties=Text;");
  </code></pre>
  
  <blockquote>
    <blockquote>
      <p>But still I am not able to import the data.Can any one help me out on this ?</p>
      
      <p>I am importing data from .xls files only.</p>
    </blockquote>
  </blockquote>