We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
Syncfusion Feedback


Trusted by the world’s leading companies

Syncfusion Trusted Companies

Overview

The Syncfusion .NET Excel Library (XlsIO) offers comprehensive support for converting CSV files to Excel format. It allows users to create Excel documents from CSV files, supporting various CSV formats. Formats such as CSV, TXT, and other delimited files can be converted into Excel formats like .xlsx, .xls, .xlsm, and .xltm.


How to convert CSV to Excel in C#

Here is an example of how to save a CSV file as an Excel document using C#.

using (ExcelEngine excelEngine = new ExcelEngine())
{
    IApplication application = excelEngine.Excel;
    application.DefaultVersion = ExcelVersion.Xlsx;

    using (FileStream inputStream = new FileStream("sample.csv",FileMode.Open, FileAccess.Read))
    {
        //Opening CSV document with comma separator.
        IWorkbook workbook = application.Workbooks.Open(inputStream, ",");
        using (FileStream outputStream = new FileStream("Output.xlsx", FileMode.Create, FileAccess.ReadWrite))
        {
            //Save the CSV data as Excel.
            workbook.SaveAs(outputStream);
        }
    }
}

How to convert TSV to Excel in C#

Here is an example of how to convert a TSV file to Excel in C#.

using (ExcelEngine excelEngine = new ExcelEngine())
{
    IApplication application = excelEngine.Excel;
    application.DefaultVersion = ExcelVersion.Xlsx;

    using (FileStream inputStream = new FileStream("sample.tsv", FileMode.Open, FileAccess.Read))
    {
        IWorkbook workbook = application.Workbooks.Open(inputStream, "\t");

        using (FileStream outputStream = new FileStream("Output.xlsx", FileMode.Create, FileAccess.ReadWrite))
        {
            // Save the workbook in Excel format.
            workbook.SaveAs(outputStream);
        }
    }
}

Use cases

Developers can also use the Syncfusion .NET Excel Library to perform the following conversions:



Awards

Greatness—it’s one thing to say you have it, but it means more when others recognize it. Syncfusion is proud to hold the following industry awards.

Scroll up icon