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

EPPlus search Worksheet by name

Dec 18, 2012 at 2:34 PM

Hello everybody

Now i'm using workBook.Worksheets.First() to open the first worksheet of a XLSX file.

There's a way to open a specify worksheet through a given string?

Thanks everybody


Dec 19, 2012 at 11:37 AM
Edited Dec 19, 2012 at 11:37 AM

Yes it is possible, Worksheets is indexed with string.

        public ExcelWorksheet GetWorksheet(string a_name)
            return m_excelPackage.Workbook.Worksheets[a_name];



Jan 29, 2013 at 9:07 PM


public static void HideSheet(string srcFile, string sheet)
                FileInfo file = new FileInfo(srcFile);
                ExcelPackage package = new ExcelPackage(file);
                ExcelWorksheet mySheet = package.Workbook.Worksheets.First(x => x.Name == sheet);
                mySheet.Hidden = eWorkSheetHidden.Hidden;                
            catch (Exception ex)
That way you can use things like x.Name.Comtains, etc.