title: Read excel file content in wpf application
body: <p>I want to read excel file in my C#,WPF application. which is running on  different machines having different versions of excels(some has excel-2003 while some machines have excel-2007 etc and some machines doesn't have any office installed at all). I want to read excel file content regardless of with/without any excel versions/packages installed on the target machines.</p>
  
  <p>I am currently using Microsoft.Office.Interop.Excel to read data from excel file but on running my app on target machine which doesn't have any office installed, my application doesn't work.</p>
  
  <p>How can I do it?
  I am doing it the following way, added namespaces</p>
  
  <pre><code> using Excel = Microsoft.Office.Interop.Excel;
  </code></pre>
  
  <p>Here comes the method's body:</p>
  
  <pre><code>Excel.Application xlApp = new Excel.Application();
              Excel.Workbook xlWorkBook;
              Excel.Worksheet xlWorkSheet;
              Excel.Range range;
              xlWorkBook = xlApp.Workbooks.Open(_filePath);
              List&lt;string&gt; Folders = new List&lt;string&gt;();
              try
              {
                  xlWorkSheet = (Excel.Worksheet)xlWorkBook.Worksheets.get_Item(1);
                  range = xlWorkSheet.UsedRange;
  
  
                  for (int cCnt = 1; cCnt &lt;= range.Columns.Count; cCnt++)
                  {
                      Folders.Add(((range.Cells[1, cCnt] as Excel.Range).Value).ToString());
                  }
              }
              catch (Exception ex)
              {
                  //some error msg
              }
              finally
              {
                  xlWorkBook.Close();
                  xlApp.Quit();
              }
              return Folders;
          }
  </code></pre>