Information is sometimes exchanged as key, value pairs, or comma-separated values in different scenarios. You might need to manipulate or convert such comma-separated values (CSV) to Excel (XLS/XLSX) for further processing. Likewise, you can convert Microsoft Excel files XLS/XLSX to CSV in your .NET applications using C# or VB.NET. Moreover, these conversions can help you to manipulate huge data and convert it into different file formats as per your requirements. Let us walk through the CSV to Excel and Excel to CSV conversion in C#.
- CSV to Excel or Excel to CSV Converter API – Installation
- Convert or Export CSV to Excel File XLS/XLSX using C# or VB.NET
- Convert or Export Excel File XLS/XLSX to CSV using C# or VB.NET
C# CSV to Excel or Excel to CSV Converter API – Installation
Aspose.Cells for .NET API can help you for inter-conversion of CSV and Excel (XLS/XLSX) files. You can easily install the API within a couple of minutes. You can download it from New Releases or you can use the command below with NuGet Package Manager for Visual Studio IDE.
Install-Package Aspose.Cells -Version 20.11.0
Convert or Export CSV to Excel XLS/XLSX using C#
You might need to fill data in an Excel file, where the input data exists in CSV format. Likewise, there could be a lot of scenarios where you would need to convert CSV file to XLS or XLSX file format. You need to follow the steps below for converting a CSV file to Excel file:
- Load input CSV file using LoadOptions
- Initialize Workbook object
- Save output Excel file
The code below elaborates how to convert CSV file to Excel XLS/XLSX file using C# or VB.NET:
Convert or Export Excel XLS/XLSX to CSV using C#
Excel to CSV file conversion is helpful in different data manipulation scenarios. You can convert the data in an Excel file to Comma Separated Values (CSV) by following the steps listed below:
- Load the input Excel file
- Save output CSV file
The following code shows how to convert Excel file XLS/XLSX to CSV using C# or VB.NET:
Conclusion
In this article, you have learned how to convert CSV files to Excel and Excel files to CSV format using C# or VB.NET. Likewise different other file format conversions are also possible that you can explore by visiting API References and Product Documentation. Moreover, you can always reach out to us at Free Support Forum.