Created
December 27, 2025 22:29
-
-
Save mustafabutt-dev/f156b23704b7b5e70854874bd7fa9f6c to your computer and use it in GitHub Desktop.
Convert CSV to Excel in C# with Aspose.cells
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| using System; | |
| using Aspose.Cells; | |
| class CsvToExcelConverter | |
| { | |
| static void Main() | |
| { | |
| // Path to the source CSV file | |
| string csvPath = "input.csv"; | |
| // Path where the Excel file will be saved | |
| string excelPath = "output.xlsx"; | |
| // Configure load options for CSV | |
| LoadOptions loadOptions = new LoadOptions(LoadFormat.Csv) | |
| { | |
| Encoding = System.Text.Encoding.UTF8, | |
| Separator = ',', | |
| ConvertNumericData = true | |
| }; | |
| // Load the CSV file into a Workbook | |
| Workbook workbook = new Workbook(csvPath, loadOptions); | |
| // Save the workbook as an XLSX file | |
| workbook.Save(excelPath, SaveFormat.Xlsx); | |
| Console.WriteLine("CSV has been successfully converted to Excel."); | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment