A Comparison between IronXL and Spire XLS

What is Microsoft Office Excel? Microsoft Excel is a component of Microsoft Office that deals specifically with spreadsheets aiming to help organize numbers and data using formulas and functions.

Have you ever wondered how .NET developers deal with Excel files? This article will discuss how developers deal with Excel files and which tools are best suited to the job of saving, reading and editing data in Excel documents. .NET developers find it very difficult to convert Excel files and edit existing Excel documents. Today, we will compare two of the popular .NET libraries that deal with Excel documents. These are:

  • Spire XLS
  • IronXL

2. Spire XLS

Spire.XLS for .NET is a professional Excel .NET API that can be used in any .NET (C#, VB .NET, ASP.NET,.NET Core,.NET 5.0, MonoAndroid, and Xamarin.iOS) application to create, read, write, convert, and print Excel files. Spire.XLS for .NET is an object model Excel API that allows you to generate new Excel documents from templates, edit existing Excel documents, and convert Excel files on the .NET platform.

This professional .NET Excel API is a managed Excel .NET assembly requiring Microsoft Excel. Spire.XLS for .NET supports the classic Excel 97-2003 format (.xls) and the modern Excel  (.xlsx,.xlsb,.xlsm) formats. It is quick and reliable compared to designing your own spreadsheet manipulation solution or using Microsoft Automation.

Excel encryption/decryption, cell hide/unhide, as well as worksheet lock/unlock are just a few of the security capabilities available in Spire.XLS for .NET class library.

2.1. Spire.XLS Features

2.1.1. Platforms

Spire.XLS for .NET allows developers to create ASP .NET, Web Services, WinForms, and other types of applications for any .NET Framework version from 2.0 to 4.5,. NET 5.0, .NET core, .NET Standard, MonoAndroid, Xamarin and iOS. It supports both 32-bit and 64-bit systems.

2.1.2. File Conversion

Spire.XLS enables users to both convert Excel files to different formats and files in different formats to Excel files.

  1. Excel to Text
  2. Excel to Image
  3. Excel to PDF file
  4. Excel to HTML
  5. XML/CSV to Excel file
  6. Excel to XPS
  7. Excel to SVG

2.1.3. Contents and Features

Spire.XLS for .NET comes with a long list of features to edit and manipulate Excel files, the most important of which are given below:

  • To create and edit Excel workbooks.
  • To save Excel to file streams.
  • To find and replace data from Excel workbooks.
  • To sort and validate data.
  • To print files.
  • To delete, insert or hide rows, column and many more.

2.1.4. Formatting Features

Spire.XLS for .NET gives complete programmatic access to all spreadsheet components and formatting attributes, such as font settings, number format settings, text alignment settings, graphic objects, as well as formatting worksheets, rows, columns, or a range of Excel cells, among many others.

2.1.5. Page Setup

Developers/programmers may configure Page Setup parameters using Spire.XLS for .NET.

  • Set the print area, print titles, or enable gridlines, and more.
  • Page Breaks
  • Create or update an image-based header and/or footer.
  • Change the page direction, scale, and paper size as needed.
  • Set your page centering and margins.

3. IronXL

IronXL is a .NET library allowing developers to deal with Excel and other spreadsheet files in C# quickly and straightforwardly. Office Interop isn't required. There are no particular requirements or the need to install Microsoft Office on Core or Azure.

Iron Software's IronXL software package reads and writes Excel (XLS, XLSX, and CSV) files simply in C# and other .NET languages. .NET Core 2, Framework 4.5, Azure, Mono, Mobile, and Xamarin are all supported by IronXL.

IronXL is a leading .NET Core and .NET Excel spreadsheet library for C# and VB. NET. The IronXL library is used to create and export XLSX, XLS, CSV, TSV, JSON and XML documents.

We can also export to System.Data.DataSet and System.Data.DataTable objects for interoperability with SQL.

3.1. IronXL Features

3.1.1. Load, Read, and Edit Data

IronXL allows users to manipulate Excel files in order to load, read and edit data from XLS/XLSX/CSV/TSV.

3.1.2. Saving and Exporting

IronXL allows users to save and export Excel files to XLS/XLSX/CSV/TSV/JSON formats.

3.1.3. System.Data Objects

IronXL works with Excel spreadsheets as System.Data.DataSet and System.Data.DataTable objects.

3.1.4. Formulas

IronXL works with Excel formulas. Formulas are recalculated every time a sheet it edited.

3.1.5. Ranges

Easy to use WorkSheet ["A1:B10"] syntax. Combine and create ranges intuitively.

3.1.6. Sorting

Sort ranges, columns, and rows.

3.1.7. Styling

Excel cell visual styles font, size, background pattern, border, alignment and number formats.

4. Creating a New Project in Visual Studio

Open the Visual Studio software and go to the File menu. Select "new project" and then select console application.

Enter the project name and select the path in the appropriate text box. Then, click the create button. Select the required .NET framework, as in the screenshot below:

The Visual Studio project will now generate the structure for the selected application, and if you have selected the console, Windows, and web application, it will open the program.cs file where you can enter the code and build/run the application.

Now we can add the library and test the program.

5. Install the IronPDF Library

The IronXL library can be downloaded and installed in four different ways. These are:

  • Using the Visual Studio NuGet Package Manager
  • Using the Visual Studio Command-Line.
  • Direct Download from the NuGet Webpage.
  • Direct Download from the IronXL webpage.

5.1 Using the Visual Studio NuGet Package Manager

The Visual Studio software provides the NuGet Package Manager option to install the package directly to the solution. The below screenshot shows how to open the NuGet Package Manager.

It provides the search box to show the list of available package libraries from the NuGet website. In the package manager, we need to search for the keyword "IronXL", as in the below screenshot:

From the above image, we can see that we will get the list of relevant packages. We need to select the IronXL option and install the package to our solution.

5.2 Using the Visual Studio Command-Line

  • In the Visual Studio menu, go to Tools-> NuGet Package manager -> Package manager console
  • Enter the following line in the package manager console tab:
  • Install-Package IronXL.Excel -Version 2022.3.0

The package will now download/install to the current project and be ready to use.

5.3 Direct Download from the NuGet Webpage

The third way is to download the NuGet package directly from the webpage.

  • Navigate to the Link "https://www.nuget.org/packages/IronXL.Excel/"
  • Select the download package option from the menu on the right-hand side.
  • Double-click the downloaded package; it will be installed automatically.
  • Next, reload the solution and start using it in the project.

5.4 Direct Download from the IronXL Webpage

Click the link here to download the latest package directly from the webpage. After the download, follow the steps below to add the package to the project.

  • Right-click the project from the solution window.
  • Then, select option reference and then browse the location of the downloaded reference.
  • Next, click OK to add the reference.

6. Install the Spire.XLS

The Spire.XLS team offers nearly all the same methods to integrate the API. These are:

  • Using the Visual Studio NuGet Package Manager.
  • Using the Visual Studio NuGet Package Console.
  • Direct Download from the Spire.XLS Website.
  • Direct Download from the NuGet Website.

6.1. Using the Visual Studio NuGet Package Manager

As explained previously for IronPDF, the steps are the same for opening the NuGet Package Manager.

After opening the Package Manager, simply write Spire.XLS in the search bar.

As the above image shows, there are three results for Spire.XLS. Select the required option.

6.2. Using the Visual Studio NuGet Package Console

In the Visual Studio menu, go to Tools-> NuGet Package manager -> Package manager Console. Enter the following line in the package manager console tab: Install-Package Spire.XLS -Version 12.3.8. The package will now download/install to the current project and be ready to use.

6.3. Direct Download from the NuGet Website

The third way is to download the NuGet package directly from the webpage.

  • Navigate to the link "NuGet Gallery | Spire.XLS 12.3.8".
  • Select the download package option from the right-hand menu.
  • Double-click the downloaded package; it will install automatically.
  • Next, reload the solution and start using it in the project.

7. Create New Excel Files

Both .NET class libraries allow users to create new Excel documents with simple code.

7.1. Create New Excel Files Using IronXL

The IronXL library can be used to create Excel Sheets in XLS and XLSX formats.

Using the IronXL API it is intuitive to populate your workbook and save it all on the .NET platform.

IronXL also fully supports ASP.NET, MVC, Windows, MacOS, Linux, iOS, Android and Windows Mobile application development.

The following code shows how to create a new workbook using IronXL.

using IronXL;

WorkBook xlsWorkbook = WorkBook.Create(ExcelFileFormat.XLS);
xlsWorkbook.Metadata.Author = "IronXL";

//Add a blank WorkSheet
WorkSheet xlsSheet = xlsWorkbook.CreateWorkSheet("new_sheet");

//Add data and styles to the new worksheet
xlsSheet["A1"].Value = "Hello World";
xlsSheet["A2"].Style.BottomBorder.SetColor("#ff6600");
xlsSheet["A2"].Style.BottomBorder.Type = IronXL.Styles.BorderType.Double;

//Save the excel file
xlsWorkbook.SaveAs("NewExcelFile.xls");
using IronXL;

WorkBook xlsWorkbook = WorkBook.Create(ExcelFileFormat.XLS);
xlsWorkbook.Metadata.Author = "IronXL";

//Add a blank WorkSheet
WorkSheet xlsSheet = xlsWorkbook.CreateWorkSheet("new_sheet");

//Add data and styles to the new worksheet
xlsSheet["A1"].Value = "Hello World";
xlsSheet["A2"].Style.BottomBorder.SetColor("#ff6600");
xlsSheet["A2"].Style.BottomBorder.Type = IronXL.Styles.BorderType.Double;

//Save the excel file
xlsWorkbook.SaveAs("NewExcelFile.xls");
Imports IronXL

Private xlsWorkbook As WorkBook = WorkBook.Create(ExcelFileFormat.XLS)
xlsWorkbook.Metadata.Author = "IronXL"

'Add a blank WorkSheet
Dim xlsSheet As WorkSheet = xlsWorkbook.CreateWorkSheet("new_sheet")

'Add data and styles to the new worksheet
xlsSheet("A1").Value = "Hello World"
xlsSheet("A2").Style.BottomBorder.SetColor("#ff6600")
xlsSheet("A2").Style.BottomBorder.Type = IronXL.Styles.BorderType.Double

'Save the excel file
xlsWorkbook.SaveAs("NewExcelFile.xls")
VB   C#

7.2. Create a New Excel File Using Spire.XLS

Without installing MS Excel or any third-party library, Spire.XLS for .NET allows you to produce Excel files in the formats of Excel (.xls) 97-2003, Excel (.xlsx) 2007, and Excel (.xlsx) 2010. This Excel API allows you to create Excel files, but it also allows you to read, edit, and modify Excel files in .NET applications with ease.

Below is the sample code for you:

using Spire.Xls;
using System.IO;
namespace CreateExcelFiles
{
    class Program
    {

        static void Main(string[] args)
        {

            Workbook DEMO= new Workbook();
            Worksheet sheet = DEMO.Worksheets[0];
            sheet.Range["C10"].Text = "The sample demonstrates how to save  an Excel workbook to stream.";
            FileStream file_stream = new FileStream("DEMO.xls",                                      FileMode.Create);
            wbToStream.SaveToStream(file_stream);
            file_stream.Close();
            System.Diagnostics.Process.Start("DEMO.xls");
        }

    }
}
using Spire.Xls;
using System.IO;
namespace CreateExcelFiles
{
    class Program
    {

        static void Main(string[] args)
        {

            Workbook DEMO= new Workbook();
            Worksheet sheet = DEMO.Worksheets[0];
            sheet.Range["C10"].Text = "The sample demonstrates how to save  an Excel workbook to stream.";
            FileStream file_stream = new FileStream("DEMO.xls",                                      FileMode.Create);
            wbToStream.SaveToStream(file_stream);
            file_stream.Close();
            System.Diagnostics.Process.Start("DEMO.xls");
        }

    }
}
Imports Spire.Xls
Imports System.IO
Namespace CreateExcelFiles
	Friend Class Program

		Shared Sub Main(ByVal args() As String)

			Dim DEMO As New Workbook()
			Dim sheet As Worksheet = DEMO.Worksheets(0)
			sheet.Range("C10").Text = "The sample demonstrates how to save  an Excel workbook to stream."
			Dim file_stream As New FileStream("DEMO.xls", FileMode.Create)
			wbToStream.SaveToStream(file_stream)
			file_stream.Close()
			System.Diagnostics.Process.Start("DEMO.xls")
		End Sub

	End Class
End Namespace
VB   C#

8. CSV to Excel

CSV to Excel is one of the most popular format conversions for Excel users. IronXL and Spire.XLS both provide this conversion feature.

8.1. CSV to Excel using IronXL

IronXL enables developers to generate Excel workbooks from CSV format.

Use IronXL to quickly convert comma-separated values text files (.csv) into Excel worksheets.

It shows how to import CSV and "tab-separated values" TSV data into Excel Worksheets in C#.

  • .NET 4.5+
  • .NetCore 2+
  • .NET Standard
  • Xamarin
  • Windows Mobile
  • Mono
  • Azure Cloud hosting

Below is the code example to convert CSV to Excel programming.

using IronXL;

WorkBook workbook = WorkBook.LoadCSV("test.csv", fileFormat: ExcelFileFormat.XLSX, ListDelimiter: ",");
WorkSheet ws = workbook.DefaultWorkSheet;

workbook.SaveAs("CsvToExcelConversion.xlsx");
using IronXL;

WorkBook workbook = WorkBook.LoadCSV("test.csv", fileFormat: ExcelFileFormat.XLSX, ListDelimiter: ",");
WorkSheet ws = workbook.DefaultWorkSheet;

workbook.SaveAs("CsvToExcelConversion.xlsx");
Imports IronXL

Private workbook As WorkBook = WorkBook.LoadCSV("test.csv", fileFormat:= ExcelFileFormat.XLSX, ListDelimiter:= ",")
Private ws As WorkSheet = workbook.DefaultWorkSheet

workbook.SaveAs("CsvToExcelConversion.xlsx")
VB   C#

8.2. CSV to Excel using Spire.XLS

A CSV file is a plain text file with data separated by commas. They are commonly used to export data from one application to another. Conversions between CSV and Excel may be necessary for some circumstances. This post will show you how to use Spire.XLS for the .NET library to implement this method in C# programmatically.

using Spire.Xls;

namespace ConvertCsvToExcel
{
    class Program
    {
        static void Main(string[] args)
        {
            //Create an instance of Workbook class
            Workbook workbook = new Workbook();

            //Load a CSV file
            workbook.LoadFromFile(@"ExcelToCSV.csv", ",", 1, 1);

            //Get the first worksheet
            Worksheet sheet = workbook.Worksheets[0];

            //Access the used range in the worksheet
            CellRange usedRange = sheet.AllocatedRange;
            //Ignore errors when saving numbers in the range as text
            usedRange.IgnoreErrorOptions = IgnoreErrorType.NumberAsText;
            //Autofit columns and rows
            usedRange.AutoFitColumns();
            usedRange.AutoFitRows();

            //Save the result file
            workbook.SaveToFile("CSVToExcel.xlsx", ExcelVersion.Version2013);
        }
    }
}
using Spire.Xls;

namespace ConvertCsvToExcel
{
    class Program
    {
        static void Main(string[] args)
        {
            //Create an instance of Workbook class
            Workbook workbook = new Workbook();

            //Load a CSV file
            workbook.LoadFromFile(@"ExcelToCSV.csv", ",", 1, 1);

            //Get the first worksheet
            Worksheet sheet = workbook.Worksheets[0];

            //Access the used range in the worksheet
            CellRange usedRange = sheet.AllocatedRange;
            //Ignore errors when saving numbers in the range as text
            usedRange.IgnoreErrorOptions = IgnoreErrorType.NumberAsText;
            //Autofit columns and rows
            usedRange.AutoFitColumns();
            usedRange.AutoFitRows();

            //Save the result file
            workbook.SaveToFile("CSVToExcel.xlsx", ExcelVersion.Version2013);
        }
    }
}
Imports Spire.Xls

Namespace ConvertCsvToExcel
	Friend Class Program
		Shared Sub Main(ByVal args() As String)
			'Create an instance of Workbook class
			Dim workbook As New Workbook()

			'Load a CSV file
			workbook.LoadFromFile("ExcelToCSV.csv", ",", 1, 1)

			'Get the first worksheet
			Dim sheet As Worksheet = workbook.Worksheets(0)

			'Access the used range in the worksheet
			Dim usedRange As CellRange = sheet.AllocatedRange
			'Ignore errors when saving numbers in the range as text
			usedRange.IgnoreErrorOptions = IgnoreErrorType.NumberAsText
			'Autofit columns and rows
			usedRange.AutoFitColumns()
			usedRange.AutoFitRows()

			'Save the result file
			workbook.SaveToFile("CSVToExcel.xlsx", ExcelVersion.Version2013)
		End Sub
	End Class
End Namespace
VB   C#

9. Licensing

IronXL is a library that provides a developer's license for free. IronXL also has a distinct pricing structure: the Lite bundle starts at $749 with no hidden fees. The redistribution of SaaS and OEM products is also possible. All licenses have a 30-day money-back guarantee, a year of software support and upgrades, dev/staging/production validity, and a perpetual license (one-time purchase). To see IronXL's entire price structure and license, go here.

Spire.XLS provides flexible options for licensing the Spire.XLS .NET component. It provides three different categories of licensing.

  • Free version

There are only five sheets per workbook and 200 rows per sheet in the free version. The print function isn't available. When converting Excel files to other formats, such as PDF/XPS, you can only receive the first three pages and convert the first three sheets to images.

  • Standard Edition

The Spire.XLS for .NET Standard Edition is limited to .NET and does not support printing or conversion.

Standard Edition is not compatible with .NET Core.

  • Pro Edition

The Spire.XLS Pro Edition is included in the Spire.XLS Pack and supports converting files from Excel to PDF, HTML, Excel to CSV, Excel to text, Excel to images, and Excel to XML (the Excel can be either .XLS or.XLSX).

Conclusion

IronXL for .NET enables developers to convert Excel to different formats such as XLS files to XLSX file stream. IronXL for .NET offers reading and writing Excel (XLS, XLSX, and CSV) files in C# and other .NET languages. .NET Core 2, Framework 4.5, Azure, Mono, Mobile, and Xamarin are all supported by IronXL. The IronXL library is used to create and export XLSX, XLS, CSV, TSV, JSON and XML documents. On top of all that, Iron Software offers all its five tools for the price of just two. The tools are as follows:

  • IronXL
  • IronOCR
  • IronPDF
  • IronBarcode
  • IronWebScraper

Spire.XLS for .NET allows you to create new Excel documents from templates, edit existing Excel documents, and convert Excel files with the Excel API for the .NET platform. Spire.XLS for .NET supports both the traditional Excel 97-2003 (.xls) and the current Excel (.xlsx,.xlsb,.xlsm) formats. It is quick and dependable compared to creating your own spreadsheet manipulation solution or using Microsoft Automation.

After briefly comparing both .NET tools, we now know that IronXL provides more features than Spire.XLS. The IronXL price structure is relatively low compared to that of Spire.XLS. The IronXL unlimited package for unlimited developers, locations and unlimited projects with SaaS and OME coverage and five years of support and updates retails for just $5397.00. On the other hand, the Spire.XLS Pro Edition with Site OEM subscription does not offer unlimited developers — just 50 developers. It provides unlimited locations but only one year of support and updates at the price of $15,687.00.

For more information please visit IronXL, and for downloads please visit this link.