This project has moved and is read-only. For the latest updates, please go here.

reading worksheets returns 0

Jul 31, 2013 at 10:50 AM
I have developed an import method using EPPLUS that reads .xlsx files with several worksheets and process the data in each worksheet successfully (on my development pc) however when I publish the website to our web server the code fails as it can’t find any worksheets. I believe it is because when I select the file EPPLus just creates a blank xlsx document with nothing in. Can anyone tell me if I am one the right track or point me in the right direction?
This CODE works on my development PC*
var Productsfile = new FileInfo(PathandFileName);
    //Open and read file
    using (var datafile = new ExcelPackage(Productsfile))
        //Get workbook in file
        ExcelWorkbook wkb = datafile.Workbook;
        if(wkb !=null)
            //process every worksheet
            for (int i = 1; i < wkb.Worksheets.Count + 1; i++)
                ExcelWorksheet currentworksheet = wkb.Worksheets[i];
                //Read each row missing header go to last row used
                for (int rowNumber = startRow; rowNumber <=     currentworksheet.Dimension.End.Row; rowNumber++)
                    //read each row
                    ReadCurrentWorkSheet(currentworksheet, rowNumber);
                    //Validate each row
                    Validate(currentworksheet, rowNumber);