Last active
December 8, 2020 20:29
-
-
Save dannylloyd/3a86a483f09631fecadc419bb8a14a97 to your computer and use it in GitHub Desktop.
Read data from Excel file using EPPLUS
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var path = @"C:\Temp\Path-To-File.xlsx"; | |
using (var pck = new OfficeOpenXml.ExcelPackage()) | |
{ | |
using (var stream = File.OpenRead(path)) | |
{ | |
pck.Load(stream); | |
} | |
var ws = pck.Workbook.Worksheets.First(); | |
for (int rowNum = 1; rowNum <= ws.Dimension.End.Row; rowNum++) | |
{ | |
var cellValue = ws.Cells[rowNum, 1].Value.ToString(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment