Querying Excel Worksheets using LinQ - LinQToExcel
I'm using LinQToExcel to read my excel worksheets.ExcelQueryFactory has a method that 开发者_运维技巧returns a worksheet based on worksheet name(Only one value(Name) is allowed).There is also a method that returns WorkSheet names. Is there a way to use LinQ to select multiple worksheet collection based on names.
ExcelQueryFactory test = new ExcelQueryFactory(FilePath); List names = targetExcelFactory.GetWorksheetNames().ToList(); var sheet = test.Worksheet("sheet1");
Enumerable.Select lets you turn the result from one set into a completely other set aka projection.
var result = targetExcelFactory.GetWorksheetNames()
.Select(name => test.Worksheet(name))
.ToList();
精彩评论