I have an excel file stored in SharePoint document library. I need to read this excel file and get the data programmatically from the file path
For Example: SharePoint
You can obtain the binary data from SPFile object and then open it in third party library ClosedXML
SPFile file = web.GetFile("http://servername:1000/ExcelDocs//ExcelFile.xlsx");
Stream dataStream = file.OpenBinaryStream();
XLWorkbook workbook = new XLWorkbook(dataStream);
or you can use OpenXML, which is Microsoft SDK.
SPFile file = web.GetFile("http://servername:1000/ExcelDocs//ExcelFile.xlsx");
Stream dataStream = file.OpenBinaryStream();
SpreadsheetDocument document = SpreadsheetDocument.Open(dataStream, false);
Workbook workbook = document.WorkbookPart.Workbook;
Here is the example of using OpenXML