convert excel xls xlsx to csv csharp

Comma Separated Values (CSV) are widely used to keep and share data. Most of the datasets are also made available in CSV format. On the other hand, various people use Excel XLS and XLSX formats to store the data in tabular form. However, in various cases, to process the Excel data in XLS or XLSX files, it is first converted into CSV format programmatically. In this article, we’ll show you how to convert an Excel file to CSV in C#.

C# Excel to CSV Converter - Free Download

To convert the XLS and XLSX files to CSV, we will use Aspose.Cells for .NET. It is a feature-rich API that lets you create and process Excel files seamlessly. Furthermore, it allows you to convert Excel files to various other file formats. You can download the API from releases section or install it from NuGet using the following command.

PM> Install-Package Aspose.Cells

Steps to Convert XLS to CSV in C#

Aspose.Cells for .NET makes it quite easier for you to convert Excel files to CSV format. You only need to perform the following steps.

  • Load the Excel file from the disk.
  • Save the Excel file as CSV to the desired location.

That’s it.

The following section demonstrates how to transform these steps into code and convert an XLS file to CSV in C#.

Export XLSX to CSV in C#

The following are the steps to export an XLS file to CSV in C#.

  1. Load the Excel XLS/XLSX using Workbook class.
  2. Save the XLSX file as CSV using Workbook.Save() method.

The following code sample shows how to save an Excel XLSX file as CSV in C#.

XLSX to CSV C# Converter - Get a Free License

You can convert Excel files to CSV format without evaluation limitations by getting a free temporary license.


In this article, you have learned how to convert Excel files to CSV format in C#. You can simply install Aspose.Cells for .NET and integrate Excel to CSV conversion in your applications. For more information about Aspose.Cells for .NET, visit the API references and documentation. Moreover, in case of any questions or queries, reach us at our support forum.

See Also