title: Export data from DataTable to Excel file
body: <p>I have DataTable object. How can I export it into an XLS file? 
  I tried to render it via DataGrid</p>
  
  <pre><code>DataGrid dgGrid = new DataGrid();
  dgGrid.DataSource = dt;
  dgGrid.DataBind();
  dgGrid.RenderControl(hw);
  </code></pre>
  
  <p>but the file is very large and the <code>OutOfMemoryException</code> appears.</p>
  
  <p>I can use <a href="http://epplus.codeplex.com/" rel="nofollow">http://epplus.codeplex.com/</a>.
  I need C# function.</p>