1

I'm developing an ASP.NET MVC C# Application to take data from excel file and extract info from it to replace an Email Template that user created. But I see in many results I search the method so complicated and long. I would like to know the most simply want to take data from excel file. For example, my mail template has a placeholder and I would like to extract the data from Distributor column and create a list of mail based on the excel file, how many rows does it have.

3
  • 2
    Possible duplicate of Reading Excel files from C# Commented Jun 27, 2018 at 9:40
  • Look up how to use Microsoft.Office.Interop.Excel.dll Commented Jun 27, 2018 at 10:42
  • 1
    Look at the OpenXML SDK for Excel 2007+ to read the raw file without Excel. Commented Jun 27, 2018 at 11:47

1 Answer 1

1

Do not use interop in Server environment:

Microsoft does not currently recommend, and does not support, Automation of Microsoft Office applications from any unattended, non-interactive client application or component (including ASP, ASP.NET, DCOM, and NT Services), because Office may exhibit unstable behavior and/or deadlock when Office is run in this environment. Source: Microsoft note.

Check out this library - ExcelDataReader. It is fast and reliable and definitely not requires much code.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.