问题
We have some info that is contained within an excel sheet. the excel sheet contains two columns; customer name + customer balance. Now I need to display this info inside my asp.net mvc view, basically to query the excel sheet based on the customer name and display its total balance inside my view.
In this way we will be uploading the excel sheet inside our system each month or each day , and we will be querying the excel sheet instead of the DB. So is this possible using EF ? or it is better to exact the data from the excel sheet and add it to Datable inside the database? Thanks
回答1:
You can use LinqToExcel , this provides normal linq structure to query excel sheets
回答2:
Excel is not a database system so don't think directly you can use the entity framework. But yes Excel can be read using .net APIs
回答3:
It is better to extract the data from the excel sheet and add it to Datable which you can do using oledbconnection object , connectionobject.GetOleDbSchemaTable.
回答4:
FileContextCore seems like an effort to make excel and other file types work in EF Core. Obviously this can be nice for consistency if you're already using EF Core.
来源:https://stackoverflow.com/questions/27778572/reading-data-from-excel-sheet-using-entity-framework