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
Unfortunately, activation email could not send to your email. Please try again.
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

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

Live Chat Icon For mobile
Live Chat Icon