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, ODS, CSV 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 and .NET Framework, .NET Core, or .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, ODS, CSV, TXT, XLSM, XLTX, XLTM, HTML, MHTML.
  • Output: XLSX, XLS, ODS, CSV, TXT, XLSM, XLTX, XLTM, HTML, MHTML, PDF, XPS, PNG, JPEG, GIF, BMP, TIFF, WMP.

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

Want more?

Next example GitHub

Check the next example or select an example from the menu. You can also download our examples from the GitHub.


Like it?

Download Buy

If you want to try the GemBox.Spreadsheet yourself, you can download the free version. It delivers the same performance and set of features as the professional version, but with some operations limited. To remove the limitation, you need to purchase a license.