title: How to read a Excel 2019 (.xlsx) file in c# application?
body: <p>After a lots of googling on the internet and reading a lots of post I could not handle my case and please before mark this post as a duplicate please read to end.</p>
  
  <p>I have a machine with:</p>
  
  <ul>
  <li><p><strong>Office 2019 package (Excel)</strong></p></li>
  <li><p>visual studio 2019 enterprise edition</p></li>
  <li><p>Windows 10 (X64) enterprise edition</p></li>
  </ul>
  
  <p>and want to read a simple excel file with a c# windows application but it does not work. </p>
  
  <p>Error:</p>
  
  <pre><code>System.InvalidOperationException: 
  'The 'Microsoft.ACE.OLEDB.12.0' provider is not registered on the local machine.'
  </code></pre>
  
  <p>I know this is a common prob and after searching a lot,I installed these file on my computer but it didn't fixed my error.</p>
  
  <p><a href="https://www.microsoft.com/en-us/download/details.aspx?id=13255" rel="nofollow noreferrer">Microsoft Access Database Engine 2010 Redistributable</a> x64 edition</p>
  
  <p><a href="https://www.microsoft.com/en-us/download/details.aspx?id=10910" rel="nofollow noreferrer">Microsoft Access 2010 Runtime</a> x64 edition</p>
  
  <p>And Codes:</p>
  
  <pre><code> DataTable rs = new DataTable();
  
   using (var odConnection = new 
          OleDbConnection(@"Provider=Microsoft.ACE.OLEDB.12.0;Data 
           Source=c:\myfile.xlsx;Extended Properties='Excel 
                   12.0;HDR=YES;IMEX=1;';"))
          {
              odConnection.Open();//Error, when wants to open the connection
  
              using (OleDbCommand cmd = new OleDbCommand())
              {
                  cmd.Connection = odConnection;
                  cmd.CommandType = CommandType.Text;
                  cmd.CommandText = "SELECT * FROM [Sheet1$]";
                  using (OleDbDataAdapter oleda = new OleDbDataAdapter(cmd))
                  {
                      oleda.Fill(rs);
                  }
              }
              odConnection.Close();
          }
  </code></pre>
  
  <p>I tested another source codes but got the same error,whats wrong whit this is it because of office 2019 or visual studio or must install something on my machine?</p>