title: Close EXCEL application process after data has been fetched
body: <p>I am trying to get the Columns data form an Excel file in lists by this way :</p>
  
  <pre><code>private void Form1_Load(object sender, EventArgs e)
          {
              Excel.Application xlApp = new Excel.Application();
              Excel.Workbook xlWorkbook = xlApp.Workbooks.Open(@"D:/test.xlsx");
              Excel.Worksheet xlWorksheet = xlWorkbook.Sheets[1];
              Excel.Range xlRange = xlWorksheet.UsedRange;
  
              int rowCount = xlRange.Rows.Count;
              int colCount = xlRange.Columns.Count;
  
              List&lt;string&gt; FirstColumnValues = new List&lt;string&gt;();
              List&lt;string&gt; SecondColumnValues = new List&lt;string&gt;();
  
              for (int row=1; row &lt;= rowCount; row++)
              {
                  for (int col = 1; col &lt;= colCount; col++)
                  {
                      switch (col)
                      {
                          case 1:
                              FirstColumnValues.Add(xlRange.Cells[row, col].Value2.ToString());
                              break;
                          case 2:
                              SecondColumnValues.Add(xlRange.Cells[row, col].Value2.ToString());
                              break;
                      }
                  }
              }
  
              if (FirstColumnValues.Count != 0 &amp;&amp; SecondColumnValues.Count != 0)
              {
                  xlWorkbook.Close();
                  xlApp.Quit();
                  MessageBox.Show("Completed");
                  Marshal.ReleaseComObject(xlRange);
                  Marshal.ReleaseComObject(xlWorksheet);
                  Marshal.ReleaseComObject(xlWorkbook);
                  Marshal.ReleaseComObject(xlApp);
                  xlApp = null;
              }
          }
  </code></pre>
  
  <p>The problem is, that the process <code>EXCEL.EXE</code> is not closing even I have tried all the things to close it properly. I know there are many questions posted here about closing excel process properly. But I am not a professional and I have tried almost everything what I can do. 
  Still no luck.</p>
  
  <p>So, Can anybody please tell me what is wrong with this code? And how the process can be closed once when all the data is stored in the lists?</p>