title: EPPLUS throwing exception while using worksheet.Insertrow(int rowfrom, int rows, int startrowfrom) in .net core 3.1 app
body: <p>I am developing an webapp using .net core 3.1 and I am getting some EPPLUS EXCEPTION like &quot;Invalid Address format APPID&quot;.
  here is my error log:</p>
  <pre><code>2020-07-08T13:13:25.9386149-04:00 0HM13C84RA267:00000002 [ERR] Invalid Address format APPID (5598a7b8)
  2020-07-08T13:13:26.3540346-04:00 0HM13C84RA267:00000002 [ERR]    at OfficeOpenXml.ExcelCellBase.ThrowAddressException(String address, Int32&amp; row, Int32&amp; col, Boolean throwException)
     at OfficeOpenXml.ExcelCellBase.GetRowCol(String address, Int32&amp; row, Int32&amp; col, Boolean throwException, Boolean&amp; fixedRow, Boolean&amp; fixedCol)
     at OfficeOpenXml.ExcelCellBase.GetRowColFromAddress(String CellAddress, Int32&amp; FromRow, Int32&amp; FromColumn, Int32&amp; ToRow, Int32&amp; ToColumn, Boolean&amp; fixedFromRow, Boolean&amp; fixedFromColumn, Boolean&amp; fixedToRow, Boolean&amp; fixedToColumn)
     at OfficeOpenXml.ExcelAddressBase.SetAddress(String address)
     at OfficeOpenXml.ExcelNamedRangeCollection.Insert(Int32 rowFrom, Int32 colFrom, Int32 rows, Int32 cols, Func`2 filter, Int32 lowerLimint, Int32 upperLimit)
     at OfficeOpenXml.ExcelNamedRangeCollection.Insert(Int32 rowFrom, Int32 colFrom, Int32 rows, Int32 cols, Int32 lowerLimint, Int32 upperLimit)
     at OfficeOpenXml.Core.Worksheet.WorksheetRangeInsertHelper.InsertCellStores(ExcelWorksheet ws, Int32 rowFrom, Int32 columnFrom, Int32 rows, Int32 columns, Int32 columnTo)
     at OfficeOpenXml.Core.Worksheet.WorksheetRangeInsertHelper.InsertRow(ExcelWorksheet ws, Int32 rowFrom, Int32 rows, Int32 copyStylesFromRow)
     at OfficeOpenXml.ExcelWorksheet.InsertRow(Int32 rowFrom, Int32 rows, Int32 copyStylesFromRow)
     at Api.Utility.ExcelHelper.abc(String templatePath, String targetFile, List`1 lstSmallDollarWriteoff, String userId, String userName, String monthYearFolder, Int64 eventLogId)
  </code></pre>
  <p>my code is like below :</p>
  <pre><code>using (ExcelPackage excelPackage = new ExcelPackage(new FileInfo(targetFile), new FileInfo(templatePath)))
              {                
                  int startRow = 13;
                  int counter = 1;
                  ExcelWorksheet objWorksheet = excelPackage.Workbook.Worksheets[&quot;Journal Entry&quot;];
                  //Posting date
                  objWorksheet.Cells[8, 2].Value = DateTime.Now.ToString(&quot;MM/dd/yyyy&quot;);
                  var lstGroup = lstdata.GroupBy(x =&gt; new { x.Company, x.Currency, x.Division }).
                  Select(x =&gt; new { x.Key, Amount = x.Sum(y =&gt; y.Amount) });
                  int rows = lstdata.Count + lstGroup.Count();
                  int rowFrom=(startRow + 1);
  
                  objWorksheet.InsertRow( rowFrom, rows, startRow); //Here, for executing this, I am getting the exception
                  foreach (var item in lstGroup)
                  {
                      List&lt;SettleData&gt; lstSDataByKey = lstDataByKey.Where(x =&gt; x.Division == item.Key.Division &amp;&amp; x.Company == item.Key.Company &amp;&amp; x.Currency == item.Key.Currency).ToList();
                      foreach (SettleData keyItem in lstDataByKey)
                      {
                          CreateJetsEntry(ref startRow, ref counter, objWorksheet, keyItem);
                      }
                  }
                  excelPackage.Save();
              }
          }
  </code></pre>
  <p>I have used EPPLUS in my appsettings.json like below :</p>
  <pre><code>&quot;EPPlus&quot;: {
      &quot;ExcelPackage&quot;: {
          &quot;LicenseContext&quot;: &quot;Commercial&quot; 
          }
      },
  </code></pre>
  <p>Any leads will be appreciated. I am stuck in this for a while.</p>