Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I use LinqToExcel to get the sheet names of an Excel file?

I am using LinqToExcel. I want to be able to get the names of all sheets in an Excel file and compare them with an input value from my html form such that when the input value does not match any of the names on the Excel sheet, the system throws an exception. How do I go about using LinqToExcel to do this?

like image 615
plasteezy Avatar asked Dec 03 '22 01:12

plasteezy


1 Answers

The documentation says:

The GetWorksheetNames() method can be used to retrieve the list of worksheet names in a spreadsheet.

var excel = new ExcelQueryFactory("excelFileName");
var worksheetNames = excel.GetWorksheetNames();
like image 118
driis Avatar answered Dec 24 '22 01:12

driis