New to Telerik Document ProcessingStart a free 30-day trial

Convert CSV to XLSX

Updated on Feb 19, 2026
Product VersionProductAuthor
2020.1.310RadSpreadProcessingDimitar Karamfilov

Description

The below example shows how you can easily convert a CSV file to XLSX format.

Solution

Use the SpreadProcessing library to convert the file.

Convert CSV to XLSX

csharp
    static void Main(string[] args)
    {
        string fileName = @"..\\..\FileName.csv";
        if (!File.Exists(fileName))
        {
            throw new FileNotFoundException(String.Format("File {0} was not found!", fileName));
        }

        Workbook workbook;
        var csvFormatProvider = new CsvFormatProvider();

        using (Stream input = new FileStream(fileName, FileMode.Open))
        {
            workbook = csvFormatProvider.Import(input);
        }


        string resultFile = @"..\\..\ResultFile.xlsx";

        var formatProvider = new Telerik.Windows.Documents.Spreadsheet.FormatProviders.OpenXml.Xlsx.XlsxFormatProvider();

        using (Stream output = new FileStream(resultFile, FileMode.Create))
        {
            formatProvider.Export(workbook, output);
        }

        System.Diagnostics.Process.Start(resultFile);
    }
In this article
DescriptionSolution
Not finding the help you need?
Contact Support