title: Using C# Microsoft.Office.Interop.Excel but Getting error Could not load file Version=15.0.0.0
body: <p>Trying to import the data from an Excel sheet into a Sql Server table. The code is activated by a button in a userform. But I am getting the error below when clicking it. I am using a work machine and we have Microsoft Excel 365. I have read this can be an issue, but is the below saying it cannot find the interop file? I've read around but I cannot workout which answers relate to my specific issue.</p>
  <blockquote>
  <p>System.IO.FileNotFoundException: Could not load file or assembly 'office, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c'. The system cannot find the file specified.
  File name: 'office, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c'</p>
  </blockquote>
  <pre><code>using Microsoft.Office.Interop.Excel;
  
  namespace FormSqlInsertCsv
  {
      public partial class Form1 : Form
      {
          public Form1()
          {
              InitializeComponent();
          }
  
          private void btnImport_Click(object sender, EventArgs e)
          {
              Microsoft.Office.Interop.Excel.Application xlApp;
              Microsoft.Office.Interop.Excel.Workbook xlWorkbook;
              Microsoft.Office.Interop.Excel.Worksheet xlWorksheet;
              Microsoft.Office.Interop.Excel.Range xlRange;
  
              int xlRow;
              string strFileName;
  
              openFD.Filter = &quot;Excel Office |*.xls; *xlsx&quot;;
              openFD.ShowDialog();
              strFileName = openFD.FileName;
  
              if(strFileName != &quot;&quot;)
              {
                  xlApp = new Microsoft.Office.Interop.Excel.Application();
                  xlWorkbook = xlApp.Workbooks.Open(strFileName);
                  xlWorksheet = (Worksheet)xlWorkbook.Worksheets[&quot;Sheet1&quot;];
                  //xlRange = xlWorksheet.UsedRange;
                  xlRange = (Microsoft.Office.Interop.Excel.Range)xlWorksheet.UsedRange;
  
                  int i = 0;
  
                  for(xlRow = 2; xlRow &lt;= xlRange.Rows.Count; xlRow++)
                  {
                      i++;
                      dgvEmployees.Rows.Add(i, xlRange.Cells[xlRow, 1].ToString(), xlRange.Cells[xlRow, 2].ToString(), xlRange.Cells[xlRow, 3].ToString(), xlRange.Cells[xlRow, 4].ToString(), xlRange.Cells[xlRow, 5].ToString(), xlRange.Cells[xlRow, 6].ToString());
  
                  }
                  xlWorkbook.Close();
                  xlApp.Quit();
              }
          }
      }
  }
  </code></pre>