title: c# Microsoft.Office.Interop.Excel export
body: <p>I'm writing a program in which I'm using C# language, <code>DataSet</code>, etc. I have about 200 000 values what I want to export to an .xlsx document.</p>
  
  <p>My code:</p>
  
  <pre><code>using Excel = Microsoft.Office.Interop.Excel;
  ...
  Excel.Application excelApp = new Excel.Application();
  Excel.Workbook excelworkbook = excelApp.Workbooks.Open(/location/);
  Excel._Worksheet excelworkSheet = (Excel.Worksheet)excelApp.ActiveSheet;
  ...
  excelApp.visible = true;
  ...
  for (int i = 0; i &lt; /value/; i++)
   for (int j = 0; j &lt; /value/; j++) 
    excelworkSheet.Cells[i, j] = /value/;
  </code></pre>
  
  <p>It works well, but it is too slow (at least 5-10 minutes).</p>
  
  <p>Have you got any advice?</p>