CSV files are widely used to store the data in the form of comma-separated values. However, in certain cases, you need to export data from CSV files to Excel spreadsheets or vice versa. For such cases, this article covers how to export data from CSV to Excel and Excel to CSV on Linux.
CSV to Excel or Excel to CSV Converter for Linux
To export data from CSV to Excel or Excel to CSV, we will use Aspose.Cells for .NET. It is a powerful API for creating and manipulating Excel files from within the .NET applications. You can either download the API or install it via NuGet.
If you are new to .NET development on Linux, read how to create a console application on Linux using Visual Studio Code. For the installation of Aspose.Cells for .NET in your application, you can use the NuGet Package Manager extension for Visual Studio Code.
Convert CSV to Excel XLSX/XLS on Linux
The following are the steps to convert a CSV file to Excel XLSX/XLS on Linux.
- Create an instance of LoadOptions class and specify the input format.
- Create an instance of Workbook class and initialize it with CSV file’s path and LoadOptions object.
- Convert CSV to Excel using Workbook.Save(string, SaveFormat.Xlsx) method.
The following code sample shows how to convert a CSV file to Excel XLSX.
Convert Excel to CSV on Linux
The following are the steps to convert an Excel XLSX/XLS file to CSV format.
- Create an instance of Workbook class and initialize it with Excel file’s path.
- Convert Excel to CSV using Workbook.Save(string, SaveFormat.Csv) method.
The following code sample shows how to convert an Excel XLSX file to CSV.
Get a Free License
You can use Aspose.Cells for .NET without evaluation limitations using a temporary license.
Conclusion
In this article, you have learned how to convert CSV files to Excel XLSX/XLS on Linux. Moreover, you have seen how to export data from Excel spreadsheets to CSV files. You can explore more about Aspose.Cells for .NET using the documentation. In case you would have any queries, you can ask us via our forum.