开发者

Custom LINQ provider for Excel spreadsheets?

开发者 https://www.devze.com 2022-12-12 14:26 出处:网络
Does anyone know a good 开发者_运维技巧custom LINQ provider to query data from Excel spreadsheets?The Linq to Excel open source project implements a simple and intuitive LINQ provider for getting data

Does anyone know a good 开发者_运维技巧custom LINQ provider to query data from Excel spreadsheets?


The Linq to Excel open source project implements a simple and intuitive LINQ provider for getting data from Excel spreadsheets. It takes care of creating the OLEDB connection and sql statement in the background as well as populating the return object properties.

For example, the code below reads the data from excel and returns a list of User objects. It automatically maps the column names in the spreadsheet to the property names on the class.

var book = new ExcelQueryFactory(@"C:\Users.xls");
var administrators = from x in book.Worksheet<User>()
                     where x.Role == "Administrator"
                     select x;

Checkout the project home page and be sure to view the introductory video.

0

精彩评论

暂无评论...
验证码 换一张
取 消