title: Is it possible to copy row (with data, merging, style) in Excel using Epplus?
body: <p>The problem is that I need to insert data into Excel from the collection several times using a single template for the entire collection.</p>
  
  <pre><code>using (var pckg = new ExcelPackage(new FileInfo(association.TemplatePath)))
  {
      var workSheet = pckg.Workbook.Worksheets[1];
      var dataTable = WorksheetToDataTable(workSheet);
      /*Some stuff*/
      FindAndReplaceValue(workSheet, dictionary, row);
  }
  
  private DataTable WorksheetToDataTable(ExcelWorksheet oSheet)
  {
      int totalRows = oSheet.Dimension.End.Row;
      int totalCols = oSheet.Dimension.End.Column;
      DataTable dt = new DataTable(oSheet.Name);
      DataRow dr = null;
      for (int i = 1; i &lt;= totalRows; i++)
      {
          if (i &gt; 1) dr = dt.Rows.Add();
          for (int j = 1; j &lt;= totalCols; j++)
          {
              if (i == 1)
                  dt.Columns.Add((oSheet.Cells[i, j].Value ?? "").ToString());
              else
                  dr[j - 1] = (oSheet.Cells[i, j].Value ?? "").ToString();
          }
      }
      return dt;
  }
  </code></pre>
  
  <p>First picture - My template. Second - First element of collection (with data, style, merging). Third - Other elements has only data</p>
  
  <p><img src="https://i.stack.imgur.com/6cJSc.png" alt="This is my template">
  <img src="https://i.stack.imgur.com/R03pW.png" alt="First element of collection has data, style, merging">
  <img src="https://i.stack.imgur.com/XHWXh.png" alt="Other elements got nothing besides data"></p>