I use the LINQ library to read data from excel file in my MVC Application, but it needs to be installed : Microsoft Access Database Engine 2010 Redistributable.
Is there any method to use LINQ without an installation of this Microsoft framework?
In case of Microsoft Excel 2007 or newer:
These files (.xlsx) are in the OpenXML format which is a zip archive inside containing XML-formated files. You can extract this zip archive and use LINQ to XML to query data - but note, it will be a really raw data.
Alternatively, you should use a dedicated library provided by Microsoft: Open XML SDK
You don't need to install anything (e.g. MS Office) - just reference the library to the MVC project.
Then you can query data in a more user-friendly way with LINQ syntax too.
var refIndex = 7; var sheetData = worksheetPart.Worksheet.GetFirstChild<SheetData>(); var row = sheetData.Elements<Row>().FirstOrDefault(x => x.RowIndex >= rowIndex);