title: C# Microsoft Interlop Slow-Take range into an array
body: <p>I have the following code in c# which reads from an Excel file using Microsoft Interop </p>
  
  <pre><code>Application xlApp;
  Workbook xlWorkBook;
  Worksheet xlWorkSheet;
  Range range;
  
  string str;
  
  xlApp = new Application();
  xlWorkBook = xlApp.Workbooks.Open("c:\\telltales.xlsx");
  xlWorkSheet = (Worksheet)xlWorkBook.Worksheets.get_Item(1);
  
  range = xlWorkSheet.UsedRange;
  
  DataTable dt = new DataTable();
  for (int Cnum = 4; Cnum &lt; 12; Cnum++)
  {
      dt.Columns.Add(new DataColumn(Convert.ToString((range.Cells[2, Cnum] as Excel.Range).Value2)));
  }
  
  dt.AcceptChanges();
  for (int Rnum = 10; Rnum &lt;= 45; Rnum++)
  {
      DataRow dr = dt.NewRow();
      for (int Cnum = 4; Cnum &lt; 12; Cnum++)
      {
          if ((range.Cells[Rnum, Cnum] as Excel.Range).Value2 != null)
          {
              dr[Cnum - 2] = (range.Cells[Rnum, Cnum] as Excel.Range).Value2.ToString();
          }
      }
  
      dt.Rows.Add(dr);
      dt.AcceptChanges();
  } 
  </code></pre>
  
  <p>At the end, the data is displayed in a DataTable. The Code is working fine, the only problem is if I have too many rows the reading is very, very slow because it  <strong>reads cell by cell</strong>.</p>
  
  <p>Is there any way that I could get all the data into an array, so I can display it into the DataTable easy and <strong>fast</strong>?</p>