This project has moved. For the latest updates, please go here.

Repaired Records: Worksheet properties from /xl/workbook.xml part


When I create spreadsheet with many worksheets via my site using EPPlus, I get the following error:

Excel found unreadable content in ViewData2023_all.xlsx Do you want to recover the contents of this workbook? If you trust the source of this workbook, click Yes.

Then I get the Repairs popup, and when I open up the log file I see:

<recoveryLog xmlns=""><logFileName>error094560_01.xml</logFileName><summary>Errors were detected in file 'C:\Users\xxx\Downloads\ViewData2023_all.xlsx'</summary>-<repairedRecords summary="Following is a list of repairs:"><repairedRecord>Repaired Records: Worksheet properties from /xl/workbook.xml part (Workbook)</repairedRecord></repairedRecords></recoveryLog>

Here is a sample of the code:
using (ExcelPackage package = new ExcelPackage())
                foreach (Install install in Installs)
                 DataWorksheet dwtest = BuildDataWorksheet(site1ID_int, install.InstallID.ToString(), StartDate, EndDate);
                    if (dwtest.DataRecords.Count > 0)

                        string worksheetName = dwtest.Name;

                        ExcelWorksheet ws = package.Workbook.Worksheets.Add(worksheetName);

                        int chssz = dwtest.ColumnHeaders.Count;

                        int worksheet_col = 0;
                        int worksheet_row = 0;
                        for (int hdr_col = 1; hdr_col <= dwtest.ColumnHeaders.Count; hdr_col++)
                            worksheet_col = hdr_col - 1;
                            ws.Cells[1, hdr_col].Value = dwtest.ColumnHeaders[worksheet_col];

                        for (int cell_row = 2; cell_row <= (dwtest.DataRecords.Count + 1); cell_row++)
                            worksheet_row = cell_row - 2;
                            for (int cell_column = 1; cell_column <= dwtest.DataRecords[worksheet_row].CellValues.Count; cell_column++)
                                worksheet_col = cell_column - 1;
                                ws.Cells[cell_row, cell_column].Value = dwtest.DataRecords[worksheet_row].CellValues[worksheet_col];
                    }  // end of if DataWorksheet has DataRecords
                }  // end of foreach

                var stream = new MemoryStream();

                string fileName = "ViewData.xlsx";
                string contentType = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet";

                stream.Position = 0;
                return File(stream, contentType, fileName);
  • when I open in Excel and resave the spreadsheet is fine
  • when I create a spreadsheet with one worksheet, the spreadsheet is fine


Erwoll wrote Aug 27, 2013 at 1:31 PM

I had similar problem when opening created Excel file. We are using Excel template with several sheets with pivot tables. When the sheet with the pivot table is removed the pivotCaches node in the Workbook XML is not affected =>it still contains all pivotCache nodes even those which are related to deleted sheets.

When I deleted those pivotCache nodes from the workbook XML, Excel file was opened without the Repair popup.

MarkScott66 wrote Mar 20, 2014 at 9:17 PM

I am seeing this exact same error. Any thoughts on when a fix might be available for this issue?

TonyDaRoma wrote Mar 31, 2014 at 2:26 PM

Hi! Try this final code:

In web page, try this:

Response.ContentType = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"
Response.AddHeader("content-disposition", "attachment; filename=your_file_name.xlsx")

The last row is VERY IMPORTANT !!!

Antonio, Roma Italia

webrealityinc wrote Jan 27, 2015 at 10:28 PM

I encountered this issue as well. My case was due to the names of my worksheets. In excel, each worksheet name can only be 31 characters in length. Once I modified my code to make sure that the worksheet names were 31 characters or less, then I didn't receive the error any longer.