Need you to export your CSV data to Excel XLS worksheets programmatically? Go through this article and learn how to accurately convert the CSV data to Excel Sheet in C#.
In various cases, information is exchanged as key-value pairs, or comma-separated values (CSV). However, you might need to convert that CSV data to Excel (XLS or XLSX) format for further processing. So let us have a look at some of the easiest ways of converting CSV to Excel XLS in C#.
- C# CSV to Excel Converter – Free Download
- Steps to Convert CSV Files to Excel XLS in C#
- Export CSV to XLSX in C#
- Online CSV to Excel Converter
C# CSV to Excel Converter
Aspose.Cells for .NET is an amazing API for the inter-conversion of CSV and Excel (XLS/XLSX) files. We will use this API to convert our CSV files to XLS/XLSX formats. You can download it from New Releases or use the command below to install it from NuGet.
PM> Install-Package Aspose.Cells
Convert CSV to Excel in C#
Aspose.Cells for .NET provides the simplest way of converting CSV files to Excel XLS or XLSX format. The following are the steps that you need to perform for CSV to Excel conversion.
- Load the CSV file from the disk.
- Create a new Excel file.
- Export data from CSV file to Excel worksheet.
- Save the Excel file to the desired location.
Let’s now write the C# code to convert a CSV file to an Excel sheet.
Export CSV to Excel XLS in C#
Use the classes and methods provided below and transform your data from CSV to Excel XLS.
- Create an instance of LoadOptions class and set the load format as CSV.
- Create a Workbook object and load the CSV file.
- Save the Excel file using Workbook.Save() method to the desired location.
The code below shows how to convert a CSV file to Excel XLSX in C#.
Online CSV to Excel Converter
You can also use our free online CSV to Excel converter tool to export your CSV data to Excel sheets. This tool is based on Aspose.Cells and doesn’t require you to sign up.
Get Free CSV to XLS Converter
You can get a free temporary license and convert CSV files to Excel format without evaluation limitations.
In this article, you have learned how to convert CSV files to Excel XLS or XLSX in C#. The steps and code sample have demonstrated how to export data from a CSV file to XLSX in C#. In addition, we have provided you with an online CSV to Excel converter that you can use from any device having an internet connection.
Likewise, different other file format conversions are also possible that you can explore by visiting documentation and API references. Moreover, you can always reach out to us at our free support forum.