I have an xlsx file with two worksheets. The first worksheet has a table that is populated by the second worksheet. With just opening it as an EPPlus package and saving the package, the table is broken and each field in a column references the same cell. Looking at the underlying xml files, it appears that worksheet1.xml has the bad formulas associated with it, while table1.xml has the correct ones.
For example, column A, row 1 is ='Sheet2'!A1 and column A, row 2 = 'Sheet2'A2. After opening and saving it in EPPlus, we then have both cells in column A are ='Sheet2'A2. I have attached a before and after of the workbook. The C# code is below:
```
namespace WorkbookManager
{
class Program
{
static void Main(string[] args)
{
var options = new Options();
if (Parser.Default.ParseArguments(args, options))
{
var file = new FileInfo(@"C:\Temp\TableIssue-BeforeEPPlus.xlsx");
using (var excelPackage = new ExcelPackage(file))
{
excelPackage.SaveAs(new FileInfo(@"C:\tmp\TableIssue-AfterEPPlus.xlsx"));
}
}
}
}
}
```
For example, column A, row 1 is ='Sheet2'!A1 and column A, row 2 = 'Sheet2'A2. After opening and saving it in EPPlus, we then have both cells in column A are ='Sheet2'A2. I have attached a before and after of the workbook. The C# code is below:
```
namespace WorkbookManager
{
class Program
{
static void Main(string[] args)
{
var options = new Options();
if (Parser.Default.ParseArguments(args, options))
{
var file = new FileInfo(@"C:\Temp\TableIssue-BeforeEPPlus.xlsx");
using (var excelPackage = new ExcelPackage(file))
{
excelPackage.SaveAs(new FileInfo(@"C:\tmp\TableIssue-AfterEPPlus.xlsx"));
}
}
}
}
}
```