Convert between XLS, XLSX, ODS, CSV and HTML files from your C#/VB.NET applications

The following example shows how you can convert your spreadsheets between XLS, XLSX, XLSB, ODS, CSV, XML and HTML file formats by using only the GemBox.Spreadsheet .NET component.

Steps for converting files

You can do a basic conversion with just a few lines of code. You only need an IDE like Visual Studio or JetBrains Rider and .NET Framework, .NET Core, or any other platform that implements .NET Standard.

Follow these steps to convert from one file format to another:

  • Create or use an existing C# or VB.NET project.
  • Download and install GemBox.Spreadsheet Setup.
  • Add a reference to GemBox.Spreadsheet.dll within your C# or VB.NET project.
  • Optionally, you can add GemBox.Spreadsheet Nuget package to your C# or VB.NET project.
  • Execute the C#/VB.NET code below.

Convert Excel files online

You can test converting your Excel files with the interactive example below. Just upload your file, choose the output file format, click Run Example, and download the generated file.

The C#/VB.NET code will be compiled, and your file will be converted with only .NET framework and the GemBox.Spreadsheet component.

Upload your file (Drag file here)
using GemBox.Spreadsheet;

class Program
{
    static void Main()
    {
        // If you are using the Professional version, enter your serial key below.
        SpreadsheetInfo.SetLicense("FREE-LIMITED-KEY");

        // Load Workbook from XLSX, XLS, ODS, CSV or HTML format
        // and save it to XLSX, XLS, ODS, CSV, HTML, PDF, XPS or
        // image (PNG, JPG, etc.).
        ExcelFile.Load("%InputFileName%").Save("Convert.%OutputFileType%");
    }
}
Imports GemBox.Spreadsheet

Module Program

    Sub Main()

        ' If you are using the Professional version, enter your serial key below.
        SpreadsheetInfo.SetLicense("FREE-LIMITED-KEY")

        ' Load Workbook from XLSX, XLS, ODS, CSV or HTML format
        ' and save it to XLSX, XLS, ODS, CSV, HTML, PDF, XPS or
        ' image (PNG, JPG, etc.).
        ExcelFile.Load("%InputFileName%").Save("Convert.%OutputFileType%")
    End Sub
End Module

Supported file formats

ODS and HTML converted from XLSX file with GemBox.Spreadsheet
Screenshot of ODS and HTML file converted from XLSX file with GemBox.Spreadsheet

GemBox.Spreadsheet supports converting between the following file formats:

  • Input: XLSX, XLS, XLSB, ODS, CSV, TXT, XLSM, XLTX, XLTM, XML, HTML, MHTML.
  • Output: XLSX, XLS, XLSB, ODS, CSV, TXT, XLSM, XLTX, XLTM, HTML, MHTML, PDF, XPS, PNG, JPEG, GIF, BMP, TIFF, WMP, SVG.

For more details about supported file formats in GemBox.Spreadsheet, see the Supported File Formats help page.

See also


Next steps

GemBox.Spreadsheet is a .NET component that enables you to read, write, edit, convert, and print spreadsheet files from your .NET applications using one simple API.

Download Buy