Microsoft.Office.Interop.Excel or EPPlus for read a huge (or not) Excel file

北城余情 提交于 2019-11-29 16:12:45

Which approach did yours use? -EPPlus

What are your recommendations on this? -I've found EPPLus to be hugely faster. It is also an easier API to work with in my opinion. For many reasons, one being the lack of COM interop(both for speed and ease of use). Also has less requirements, especially when deploying to a server environment: no installing Excel junk.

Any help to write the same using EPPlus or OpenXML SDK? -EPPlus API is fairly straightfoward. Make an attempt and post more specific questions with what you've tried so far.

Another way to loop through cells:

var firstColumnRows = sheet.Cells["A2:A"];

// Loop through rows in the first column, get values based on offset
foreach (var cell in firstColumnRows)
{
    var column1CellValue = cell.GetValue<string>();
    var neighborCellValue = cell.Offset(0, 1).GetValue<string>();
}
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!