IRONSOFTWAREHOME

XLSX Code Samples

C# VB PDF .NET : Convert XLSX Spreadsheet File TypesConvert XLSX Spreadsheet File Types
using IronXL;
using System.IO;

// Import any XLSX, XLS, XLSM, XLTX, CSV and TSV
WorkBook workBook = WorkBook.Load("sample.xlsx");

// Export the excel file as XLS, XLSX, XLSM, CSV, TSV, JSON, XML
workBook.SaveAs("sample.xls");
workBook.SaveAs("sample.xlsx");
workBook.SaveAs("sample.tsv");
workBook.SaveAsCsv("sample.csv");
workBook.SaveAsJson("sample.json");
workBook.SaveAsXml("sample.xml");

// Export the excel file as Html, Html string
workBook.ExportToHtml("sample.html");
string htmlString = workBook.ExportToHtmlString();

// Export the excel file as Binary, Byte array, Data set, Stream
byte[] binary = workBook.ToBinary();
byte[] byteArray = workBook.ToByteArray();
System.Data.DataSet dataSet = workBook.ToDataSet(); // Allow easy integration with DataGrids, SQL and EF
Stream stream = workBook.ToStream();
NuGet Downloads Badge
PM > Install-Package IronXL.Excel

IronXL offers a simple and flexible way for developers to work with Excel files, allowing easy import and export across various formats. It supports file types like XLS, XLSX, CSV, JSON, XML, and HTML, making it ideal for different application needs. Developers can convert Excel data into formats suitable for web integration, APIs, or further data processing with just a few lines of code.

For example, exporting Excel files as HTML or JSON makes it easy to embed data into web applications, while converting them to binary, byte arrays, or streams helps integrate with databases or other systems. Converting Excel content into a DataSet simplifies connecting to SQL databases or populating UI components like data grids. This reduces manual coding, enhances productivity, and makes IronXL a valuable tool for modern, data-driven applications.

5 Steps to Export Excel Files in Multiple Formats

This code demonstrates the versatility of IronXL in handling and exporting Excel data across multiple formats. The process begins by loading an existing Excel file, Sample.xlsx, into a WorkBook object. This object acts as the central hub for manipulating and exporting data. Using the SaveAs method, the workbook is saved as a .xlsx file, ensuring compatibility with modern Excel applications.

Next, the SaveAsJson method converts the workbook into JSON format, making it suitable for API responses or lightweight data exchanges. The ToDataSet method enables seamless integration with databases or UI components by converting the workbook into a DataSet object, which is a .NET-native structure for handling tabular data.

Finally, the ExportToHtml method generates an HTML file, enabling developers to display the Excel data directly on web pages. These capabilities streamline data processing tasks, making IronXL an exceptional tool for developers working with Excel files.

Learn to Convert Excel File Types Effortlessly
XLSX library support

Support from our Excel Team

Iron's Excel product team is available to support all of your questions. Get in touch to ask a question on how our library can help you in your project.
Make XLSX files in C#

Create XLSX files in .NET

Create and Edit Spreadsheet files in C#. Works with Dotnet Core and Azure with no need to install MS Office or Interop.

Read & Write Multiple Formats

IronXL allows you to quickly read & write Excel Spreadsheets in your .NET APPs. Read & Edit XLS/XLSX/CSV/TSV - Save & Export to XLS/XLSX/CSV/TSV/JSON. IronXL outperforms free & Interop libraries parsing, editing, & saving Excel files.
XLSX data support

SQL to XLSX Conversion

Convert Data between Excel and SQL using System.Data.DataSet and System.Data.DataTable objects.

Edit XLSX Data

Sort and edit formulas. Familiar WorkSheet [“A1:B10”] syntax. Sort by Ranges, Columns and Rows.
Format and Style XLSX files

Format XLSX Files

Set Font, Size, Background, Border, Alignment and format.
C# XLSX Library for Visual Studio.

C# XLSX Library for Microsoft Visual Studio

IronXL creates XLSX files quickly using Visual Studio. Install with NuGet or DLL.

Supports:

  • .NET Core 2.0 and above
  • .NET Framework 4.0 and above support C#, VB, F#
  • Microsoft Visual Studio. .NET Development IDE Icon
  • NuGet Installer Support for Visual Studio
  • JetBrains ReSharper C# language assistant compatible
  • Microsoft Azure C# .NET  hosting platform compatible

Licensing & Pricing

Free community development licenses. Commercial licenses from $999.

View Full License Options

XLSX Tutorials for C# & VB .NET

How to Create Excel Files in C#
C#ExcelXLSX
Jonas Schmidt - C# Developer

Create XLSX Files in C#

See How Jonas uses IronXL to generate Excel Files without using Office Interop...

View Jonas' Excel File Generation Tutorial
Reading and Writing Excel Tutorial + Code Examples in C# & VB.NET
C#ExcelXLS
Elijah Williams - Product Development Engineer

Open and Edit XLSX Files in C# or VB

Elijah shares a no-nonsense approach to reading Excel data into C# Applications...

See Elijah's Excel Reading & Editing Tutorial
Tutorial + Code Examples VB.NET PDF Creation and Editing | VB.NET & ASP.NET PDF
C#ExcelData
Rebecca White - .NET Solution Director

How to Read XLSX Files in .NET.

Rebecca's code walkthrough for reading Excel data into a .NET application...

Read Becky's C# Tutorial

Professional developers use IronXL for...

Accounting and Finance Systems

  • # Receipts
  • # Reporting
  • # Invoice Printing
Add Excel Support to ASP.NET Accounting and Finance Systems

Business Digitization

  • # Documentation
  • # Ordering & Labelling
  • # Paper Replacement
C# Business Digitization Use Cases

Enterprise Content Management

  • # Content Production
  • # Document Management
  • # Content Distribution
.NET CMS Excel Support

Data and Reporting Applications

  • # Performance Tracking
  • # Trend Mapping
  • # Reports
C# Excel Reports
Join Them Today
Iron Software Enterprise .NET Component Developers
C# Library Developers

Thousands of corporations, governments, SMEs and developers alike trust Iron software products.

Iron's team have over 10 years experience in the .NET software component market.

Iron Customer Icon
Iron Customer Icon
Iron Customer Icon
Iron Customer Icon
Iron Customer Icon
Iron Customer Icon
Iron Customer Icon
Iron Customer Icon

Ready to Get Started?

Nuget Downloads 2,237,574Version:2026.9just released

Key in blue circle

Get your free 30-day Trial Key instantly.

Your trial license will be sent to your email address

No limitations. 100% unlocked. No credit card.

bullet_checkedNo credit card or account creation requiredNo limitations. 100% unlocked. No credit card.
  • Logo Aetna
  • Logo NASA
  • Logo GE
  • Logo Porsche
  • Logo USDA
  • Logo Qatar
Join Millions of Engineers who’ve tried IronPDF
Book your free Live Demo
Booking Badge

Trusted by Millions of Engineers Worldwide

Iron Software's customer logos
Get Your No-Obligation Consult
Complete the form below or email sales@ironsoftware.com
Your details will always be kept confidential.
Trusted by Millions of Engineers Worldwide
Iron Software's customer logos
Get your free 30-day Trial Key instantly.
No credit card or account creation required