Skip to content

Instantly share code, notes, and snippets.

@mustafabutt-dev
Created December 27, 2025 22:29
Show Gist options
  • Select an option

  • Save mustafabutt-dev/f156b23704b7b5e70854874bd7fa9f6c to your computer and use it in GitHub Desktop.

Select an option

Save mustafabutt-dev/f156b23704b7b5e70854874bd7fa9f6c to your computer and use it in GitHub Desktop.
Convert CSV to Excel in C# with Aspose.cells
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