1

Closed

There isn't a worksheet named 'New Items'

description


What am I doing?

XlWorkbook = new XLWorkbook(Helper.GetTestWorkbook(xlFilename));
Exception.Message is same as subject line.

There isn't a worksheet named 'New Items'.

EXPLANATION

What is the workaround because using another Library I do not see this error all the sheet show up.

internal static class Helper
{
public static Stream GetTestWorkbook(string fname)
    {
        fileName = Path.GetFullPath(fname);
        return new FileStream(fileName, FileMode.Open, FileAccess.Read, FileShare.ReadWrite);
    }
}
Stack Trace
at ClosedXML.Excel.XLWorksheets.Worksheet(String sheetName)
at ClosedXML.Excel.XLWorkbook.LoadDefinedNames(Workbook workbook)
at ClosedXML.Excel.XLWorkbook.LoadSpreadsheetDocument(SpreadsheetDocument dSpreadsheet)
at ClosedXML.Excel.XLWorkbook.LoadSheets(Stream stream)
at ClosedXML.Excel.XLWorkbook.Load(Stream stream)
at ClosedXML.Excel.XLWorkbook..ctor(Stream stream, XLEventTracking eventTracking)
at ClosedXML.Excel.XLWorkbook..ctor(Stream stream)
at POValidator.POHelpers.ExcelHandler.GetExcelWorkBook() in D:\POValidator\POValidator\POHelpers\ExcelHandler.cs:line 30
at POValidator.POHelpers.ExcelHandler..ctor(String xlfName) in D:\POValidator\POValidator\POHelpers\ExcelHandler.cs:line 23
at POValidator.POHelpers.XLHelper.GetFileContent() in D:\POValidator\POValidator\POHelpers\XLHelper.cs:line 26
at POValidator.POHelpers.XLHelper..ctor(FileInfo fileInfo) in D:\POValidator\POValidator\POHelpers\XLHelper.cs:line 21
at POValidator._Default.OnClickOpenClose(Object sender, EventArgs e) in D:\POValidator\POValidator\Default.aspx.cs:line 146
at System.Web.UI.WebControls.Button.OnClick(EventArgs e)
at System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument)
at System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument)
at System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument)
at System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData)
at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
Closed Apr 25 at 8:39 PM by igitur
Please try the latest version of ClosedXML (v0.87.1 at this stage). If you still experience the issue, log it on the new GitHub page.

comments

MDeLeon wrote Dec 5, 2012 at 3:58 PM

Attach a file that gives the error.