This question has already been answered:

You need a .net library to generate Excel files and CSV. Yes, there are a lot of answers on the Internet in particular, excellent answers here

But at best they date back to 2010, and much could have changed. So, what library do you recommend for now? And the pitfalls that you have when generating Excel files.

UPD Need a free library. UPD2 Need a free library with a license compatible with proprietary software.

Reported as a duplicate by participants aleksandr barakin , Denis Bubnov , user194374, Alex , Qwertiy Nov 28 '16 at 20:07 .

A similar question was asked earlier and an answer has already been received. If the answers provided are not exhaustive, please ask a new question .

  • 6
    Read this: ru.stackoverflow.com/questions/560133/…. There are several ways to interact with Excel files + there is an example of code on the best of options. (unpretentious lib to work with a two-dimensional array) - user221357

3 answers 3

To work with Excel, you can use the assembly Microsoft.Office.Interop.Excel.dll
An example of working with Excel is here.

You can also use the Open XML SDK 2.5 for Microsoft Office to work with Excel files. Examples can be found on github Office Developer .

A csv file is a plain text file that you can create, for example, like this:

File.AppendAllLines(@"c:\temp\test.csv", new[] { "1,2", "3,4" }); 
  • As I understand it, it requires an office on a PC? - Ssss
  • Yes. if not, then you can use the Open XML SDK 2.5 for Microsoft Office. - Stack

EPPlus is a very convenient library for working with Excel, which is based on Open XML

Easy to learn and saves from the use of interop.

It also has many examples and good documentation.

    You can use Aspose.Cells , but it is paid. An office is not required.