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

RESOLVED: Issue using EPPlus with Visual Studio 2012 to get the first worksheet

Feb 7, 2014 at 4:32 PM
Wondering if anyone else has had this problem. Using the code below in VS 2012 and it cannot find the ".First()" method. I put the exact same code in VS 2008 and it works fine. I do have the EPPlus.dll file referenced in both solutions. I'm using version 3.1.3 of EPPlus too. Anyone know why this would be happening? Thanks in advance.

using OfficeOpenXml;
    protected void btnImportSpreadsheet_Click(object sender, EventArgs e)
    {
        string path = FileUpload1.PostedFile.FileName;
        var excelFile = new FileInfo(path);
        using (var package = new ExcelPackage(excelFile))
        {
            // Get the work book in the file
            ExcelWorkbook workBook = package.Workbook;

            if (workBook != null)
            {
                if (workBook.Worksheets.Count > 0)
                {
                    // Get the first worksheet
                    ExcelWorksheet currentWorksheet = workBook.Worksheets.First();
                }
            }
        }
Feb 7, 2014 at 4:55 PM
This was my fault. I guess it took asking the question online in order for me to find the issue. It was not an EPPlus issue. There was something missing in my code.