title: open xml has a bad performance with large data
body: <p>Open xml write 20k row to excel file almost in 8 minutes using template which has 24 column. I have to improve this perfonmance so I must find the wrong things. Template file would cause poor perfonmace. But it hasn't any macro. Causing of poor performance would be a bug. But I haven't seen any bug about this. I need your help. How can I improve the performance using Open XMl or do you have any suggestion what is the best library to write large data to excel. </p>
  
  <ul>
  <li>OpenXml 2.5 .NetFramework 4.5</li>
  </ul>
  
  <blockquote>
    <p>worksheetPart.Worksheet.Save(); it takes 7 minutes.</p>
  </blockquote>
  
  <pre><code>Stopwatch sw = new Stopwatch();
  sw.Start();
  FileInfo temp_excel_file = new FileInfo(Path.Combine(ConfigFile.ConfigsPaths["ExcelRaporFolder"], "temp", "Monitoring.xlsm"));
  rapor_file = new FileInfo(Path.Combine(ConfigFile.ConfigsPaths["ExcelRaporFolder"], "excel", FileName + ".xlsm"));
                              File.Copy(temp_excel_file.FullName, rapor_file.FullName);
                              Log.LogYaz(rapor_file.Name + "-Excell Açılıyor..");
  SpreadsheetDocument myDoc = SpreadsheetDocument.Open(rapor_file.FullName, true);
                              IEnumerable&lt;Sheet&gt; sheets = myDoc.WorkbookPart.Workbook.Descendants&lt;Sheet&gt;();
                              WorksheetPart worksheetPart = (WorksheetPart)myDoc.WorkbookPart.GetPartById(sheets.Skip(1).First().Id);
                              SheetData sheetData = worksheetPart.Worksheet.Elements&lt;SheetData&gt;().First();
  foreach (var row_index in filtered_data)
  {
   ...
   sheetData.AppendChild(Utils.CreateRow(row, 0, cell_data));
  }
  worksheetPart.Worksheet.Save();
  myDoc.Close();
  myDoc = null;
  sw.Stop();
  </code></pre>