COMPARE TO OTHER COMPONENTS

A Comparison Between IronXL and FastExcel for .NET

Published May 8, 2023
Share:

When it comes to working with Excel documents in C#, two of the most popular libraries available are IronXL, a solution from the Iron Suite bundle, and FastExcel v4. Both libraries offer a range of tools and features that can help developers manipulate and manage Excel workbooks. These two pieces of software are individually great but great is not enough. We are going to assess the features that each offer, to determine which is the best option for your needs. In this article, we will compare IronXL and FastExcel v4, highlighting the strengths and weaknesses of each library, and providing examples of how to use both in C#.

How to Read Excel Data and Insert to Database Table in C#: Figure 1 - FastExcel V4 Check Workbook

FastExcel v4

FastExcel v4 is a family of multithreaded C# libraries that provide tools for managing Excel workbooks. The latest version of FastExcel v4 introduces new features such as Tables Sheet Manager Pro, which simplifies the management of defined names, and FastExcel SpeedTools, which helps to reduce workbook bloat.

With FastExcel v4, developers have the option to choose between automatic and manual calculation methods, depending on their needs. The library offers a wide range of tools for manipulating worksheets and workbooks, including support for unlimited formulas and calculations.

One of the major advantages of FastExcel v4 is its speed. The library is designed to be efficient, even when dealing with large or complex workbooks. It includes multithreaded calculations that can significantly speed up the calculation process, and it provides tools for managing memory usage and optimizing performance.

FastExcel v4: feature set

  • Read and write Excel files in XLSX format
  • Read data from Excel files using LINQ
  • Support for data validation and error handling
  • High-performance streaming API for reading and writing Excel files
  • Support for multi-threading for faster processing of large Excel files
  • Compatible with .NET Framework and .NET Core
  • Integration with popular libraries such as LINQ, Entity Framework, and Apache Spark

IronXL

IronXL is a powerful C# library that empowers developers to manipulate and create Excel files programmatically. It offers a familiar C# syntax and methods for reading, writing, and modifying Excel files, without any external dependencies or additional software installations.

With IronXL, developers have access to a wide range of features and tools that simplify working with Excel files. This includes support for various Excel file formats, the ability to manipulate worksheets and tables, and tools for managing defined names, number formats, and more. The library also supports automatic and manual calculation modes, along with multithreaded Excel calculations to optimize performance.

Using IronXL, developers can effortlessly create new Excel workbooks, add data to existing ones, and manipulate Excel formulas and calculations using C# code. The library also includes robust debugging tools and features like the Formula Explorer and the Tables Sheet Manager, which aid in troubleshooting and optimizing Excel code.

IronXL Feature Set

  • Load, read, and edit data from various file formats such as XLS, XLSX, CSV, and TSV.
  • Export and saving data in different file formats, including XLS, XLSX, CSV, TSV, and JSON.
  • Utilize System.Data Objects, which enable users to work with Excel WorkBook Spreadsheets as System.Data.DataSet and System.Data.DataTable objects.
  • Support for Excel formulas, which are recalculated every time a sheet is edited.
  • Allow users to create and combine ranges intuitively using its easy-to-use WorkSheet syntax.
  • Provide functionalities for sorting and filtering ranges, columns, and rows.
  • Enable users to style cells according to their preferences, including visual styles, font, size, background pattern, border, alignment, and number formats.

Manipulating Excel documents using FastExcel v4

To get started with FastExcel v4, you will need to download the latest version from the official website. You can use the trial version to evaluate the library before purchasing the fully licensed version. Once you have installed FastExcel v4, you can start using its tools to help you manage Excel files.

How to Read Excel Data and Insert to Database Table in C#: Figure 2 - ClosedXML NuGet Install

Manipulating Excel Files

FastExcel v4 provides a range of tools for manipulating Excel files in C#. You can use FastExcel v4 to open and save Excel workbooks, manipulate worksheets, manage defined names, and more. Here are some examples of how to use FastExcel v4 to manipulate Excel files:

Opening and Saving Excel Workbooks

using (var workbook = new Workbook(@"C:\Test\MyWorkbook.xlsx"))
{
    // Do some work on the workbook here
    workbook.Save();
}
using (var workbook = new Workbook(@"C:\Test\MyWorkbook.xlsx"))
{
    // Do some work on the workbook here
    workbook.Save();
}
Using workbook As New Workbook("C:\Test\MyWorkbook.xlsx")
	' Do some work on the workbook here
	workbook.Save()
End Using
VB   C#

Manipulating Worksheets

using (var workbook = new Workbook(@"C:\Test\MyWorkbook.xlsx"))
{
    var worksheet = workbook.Worksheets ["Sheet1"];
    // Do some work on the worksheet here
}
using (var workbook = new Workbook(@"C:\Test\MyWorkbook.xlsx"))
{
    var worksheet = workbook.Worksheets ["Sheet1"];
    // Do some work on the worksheet here
}
Using workbook As New Workbook("C:\Test\MyWorkbook.xlsx")
	Dim worksheet = workbook.Worksheets ("Sheet1")
	' Do some work on the worksheet here
End Using
VB   C#

Managing Defined Names


    using (var workbook = new Workbook(@"C:\Test\MyWorkbook.xlsx"))
    {
        var definedNames = workbook.DefinedNames;
        // Do some work on the defined names here
    }

    using (var workbook = new Workbook(@"C:\Test\MyWorkbook.xlsx"))
    {
        var definedNames = workbook.DefinedNames;
        // Do some work on the defined names here
    }
Using workbook As New Workbook("C:\Test\MyWorkbook.xlsx")
		Dim definedNames = workbook.DefinedNames
		' Do some work on the defined names here
End Using
VB   C#

Optimizing Calculations

One of the most significant advantages of FastExcel v4 is its ability to optimize calculations in Excel workbooks. Excel calculations can become a bottleneck as the size and complexity of a workbook grow. FastExcel v4 provides tools to help you optimize calculations and improve performance.

How to Read Excel Data and Insert to Database Table in C#: Figure 3 - Buy FastExcel V3 - Helps you to run Excel Faster - Decision Models

Automatic and Manual Calculation

By default, Excel workbooks use automatic calculation, which means that Excel recalculates formulas whenever a cell changes. This can be time-consuming, especially in large workbooks. FastExcel v4 allows you to switch between automatic and manual calculation, which can significantly improve performance. Here is an example of how to switch to manual calculation:

using (var workbook = new Workbook(@"C:\Test\MyWorkbook.xlsx"))
{
    workbook.CalculationMode = CalculationMode.Manual;
    // Do some work on the workbook here
}
using (var workbook = new Workbook(@"C:\Test\MyWorkbook.xlsx"))
{
    workbook.CalculationMode = CalculationMode.Manual;
    // Do some work on the workbook here
}
Using workbook As New Workbook("C:\Test\MyWorkbook.xlsx")
	workbook.CalculationMode = CalculationMode.Manual
	' Do some work on the workbook here
End Using
VB   C#

Array Calculation Bottlenecks

Array calculations can also become a bottleneck in Excel workbooks. FastExcel v4 provides tools to help you optimize array calculations and improve performance. Here is an example of how to optimize array calculations using FastExcel v4:

using (var workbook = new Workbook(@"C:\Test\MyWorkbook.xlsx"))
{
    workbook.OpenCalculationMethods = OpenCalculationMethods.ArrayFormulas;
    // Do some work on the workbook here
}
using (var workbook = new Workbook(@"C:\Test\MyWorkbook.xlsx"))
{
    workbook.OpenCalculationMethods = OpenCalculationMethods.ArrayFormulas;
    // Do some work on the workbook here
}
Using workbook As New Workbook("C:\Test\MyWorkbook.xlsx")
	workbook.OpenCalculationMethods = OpenCalculationMethods.ArrayFormulas
	' Do some work on the workbook here
End Using
VB   C#

How to Read Excel Data and Insert to Database Table in C#: Figure 4 - Optimizing array calculations

FastExcel Profiler

FastExcel Profiler is an invaluable tool for optimizing Excel calculations. FastExcel Profiler provides detailed information about calculation problems, excess bloat, and other issues that can affect the performance of your Excel workbooks. Here is an example of how to use FastExcel Profiler to optimize calculations:


using (var workbook = new Workbook(@"C:\Test\MyWorkbook.xlsx"))
{
    using (var profiler = new FastExcelProfiler(workbook))
    {
        // Do some work on the workbook here
        profiler.DisplayReport();
    }
}

using (var workbook = new Workbook(@"C:\Test\MyWorkbook.xlsx"))
{
    using (var profiler = new FastExcelProfiler(workbook))
    {
        // Do some work on the workbook here
        profiler.DisplayReport();
    }
}
Using workbook As New Workbook("C:\Test\MyWorkbook.xlsx")
	Using profiler = New FastExcelProfiler(workbook)
		' Do some work on the workbook here
		profiler.DisplayReport()
	End Using
End Using
VB   C#

Tables Sheet Manager Pro

FastExcel TableSheet Manager Pro is another powerful tool in the FastExcel v4 family. It provides tools to help you manage tables in your Excel workbooks. Tables Sheet Manager Pro allows you to easily manage an unlimited number of tables in a single worksheet, which can significantly reduce excess bloat and improve performance. Here is an example of how to use Tables Sheet Manager Pro:


using (var workbook = new Workbook(@"C:\Test\MyWorkbook.xlsx"))
{
    using (var manager = new TableSheetManagerPro(workbook))
    {
        // Do some work on the tables here
    }
}

using (var workbook = new Workbook(@"C:\Test\MyWorkbook.xlsx"))
{
    using (var manager = new TableSheetManagerPro(workbook))
    {
        // Do some work on the tables here
    }
}
Using workbook As New Workbook("C:\Test\MyWorkbook.xlsx")
	Using manager = New TableSheetManagerPro(workbook)
		' Do some work on the tables here
	End Using
End Using
VB   C#

Number Formats

FastExcel v4 also provides tools to help you manage number formats in your Excel workbooks. You can use FastExcel v4 to apply number formats to cells, columns, and rows in your workbooks. Here is an example of how to apply a number format using FastExcel v4:


    using (var workbook = new Workbook(@"C:\Test\MyWorkbook.xlsx"))
    {
        var worksheet = workbook.Worksheets ["Sheet1"];
        var column = worksheet.Columns ["A"];
        column.Style.NumberFormat = "#,##0.00";
    }

    using (var workbook = new Workbook(@"C:\Test\MyWorkbook.xlsx"))
    {
        var worksheet = workbook.Worksheets ["Sheet1"];
        var column = worksheet.Columns ["A"];
        column.Style.NumberFormat = "#,##0.00";
    }
Using workbook As New Workbook("C:\Test\MyWorkbook.xlsx")
		Dim worksheet = workbook.Worksheets ("Sheet1")
		Dim column = worksheet.Columns ("A")
		column.Style.NumberFormat = "#,##0.00"
End Using
VB   C#

Formula Explorer

FastExcel v4 provides a Formula Explorer tool that allows you to view the formulas in your Excel workbooks. The Formula Explorer can help you troubleshoot formula errors and optimize calculations. Here is an example of how to use the Formula Explorer:


using (var workbook = new Workbook(@"C:\Test\MyWorkbook.xlsx"))
{
    using (var explorer = new FormulaExplorer(workbook))
    {
        // Do some work on the formulas here
    }
}

using (var workbook = new Workbook(@"C:\Test\MyWorkbook.xlsx"))
{
    using (var explorer = new FormulaExplorer(workbook))
    {
        // Do some work on the formulas here
    }
}
Using workbook As New Workbook("C:\Test\MyWorkbook.xlsx")
	Using explorer = New FormulaExplorer(workbook)
		' Do some work on the formulas here
	End Using
End Using
VB   C#

Manipulating Excel documents using IronXL

To get started with IronXL, you will need to install the IronXL package. You can do this through the NuGet package manager or by downloading the package from the IronXL website. Once you have installed the package, you can begin using IronXL in your C# project.

Opening and Saving Workbooks: To open an Excel workbook using IronXL, you can use the following code:

WorkBook workbook = WorkBook.Load(@"C:\Test\MyWorkbook.xlsx");
WorkBook workbook = WorkBook.Load(@"C:\Test\MyWorkbook.xlsx");
Dim workbook As WorkBook = WorkBook.Load("C:\Test\MyWorkbook.xlsx")
VB   C#

This will open the workbook located at the specified path. You can also create a new workbook using the following code:

WorkBook workbook = WorkBook.Create(ExcelFileFormat.Xlsx);
WorkBook workbook = WorkBook.Create(ExcelFileFormat.Xlsx);
Dim workbook As WorkBook = WorkBook.Create(ExcelFileFormat.Xlsx)
VB   C#

To save a workbook using IronXL, you can use the following code:

workbook.SaveAs(@"C:\Test\MyWorkbook.xlsx");
workbook.SaveAs(@"C:\Test\MyWorkbook.xlsx");
workbook.SaveAs("C:\Test\MyWorkbook.xlsx")
VB   C#

This will save the workbook to the specified path.

How to Read Excel Data and Insert to Database Table in C#: Figure 5 - Save a workbook

Manipulating Excel Worksheets

To manipulate worksheets in a workbook using IronXL, you can use the following code:

WorkSheet worksheet = workbook.WorkSheets ["Sheet1"];
WorkSheet worksheet = workbook.WorkSheets ["Sheet1"];
Dim worksheet As WorkSheet = workbook.WorkSheets ("Sheet1")
VB   C#

This will get the worksheet named "Sheet1" from the workbook. You can then manipulate the worksheet as needed.

Managing Defined Names

IronXL provides tools to help you manage defined names in your Excel workbooks. You can use the following code to create a defined name:

worksheet.DefineName("MyRange", worksheet.Range("A1:B10"));
worksheet.DefineName("MyRange", worksheet.Range("A1:B10"));
worksheet.DefineName("MyRange", worksheet.Range("A1:B10"))
VB   C#

This will create a defined name called MyRange that refers to the range A1:B10 in the worksheet.

How to Read Excel Data and Insert to Database Table in C#: Figure 6 - CSVList

Applying Number Formats

To apply a number format to a cell or range of cells using IronXL, you can use the following code:

worksheet ["A1"].Style.NumberFormat.Format = "#,##0.00";
worksheet ["A1"].Style.NumberFormat.Format = "#,##0.00";
worksheet ("A1").Style.NumberFormat.Format = "#,##0.00"
VB   C#

This will apply the number format "#,##0.00" to cell A1 in the worksheet.

Optimizing Calculations

IronXL provides tools to help you optimize calculations in your Excel workbooks. To optimize calculations, you can use the following code:

workbook.SetAutomaticCalculation(false);
workbook.SetAutomaticCalculation(false);
workbook.SetAutomaticCalculation(False)
VB   C#

This will turn off automatic calculation in the workbook. You can then manually calculate the workbook using the following code:

workbook.Calculate();
workbook.Calculate();
workbook.Calculate()
VB   C#

This will calculate all the formulas in the workbook.

How to Read Excel Data and Insert to Database Table in C#: Figure 7 - All Formulas Calculated

Comparison

Both FastExcel and IronXL are powerful libraries for manipulating Excel files using C# language. While both libraries offer similar features, there are a few key differences that set them apart.

FastExcel is a library that focuses on improving the performance of Excel calculations, particularly when working with large datasets. It offers features like automatic and manual calculation, optimization for array calculation bottlenecks, and open calculation methods. FastExcel also provides tools like the FastExcel Profiler and FastExcel SpeedTools to help manage and optimize Excel workbooks.

On the other hand, IronXL is a library that prioritizes ease of use and flexibility. It provides a wide range of tools to help developers manipulate Excel files in C# code. Some of these tools include the ability to manage defined names, work with an unlimited number of worksheets, and easily manage number formats. IronXL also supports multithreaded Excel calculations, making it a great choice for handling large datasets.

While both FastExcel and IronXL are powerful libraries for working with Excel files in C#, IronXL has a few advantages that make it the preferred choice for many developers. First, IronXL has a more intuitive API, making it easier to work with and learn. Second, IronXL is more affordable than FastExcel, making it a better choice for smaller projects or teams with limited budgets.

Additionally, IronXL is a more lightweight library compared to FastExcel. It does not have the excess bloat that FastExcel has, which can slow down performance and make it more difficult to manage large Excel workbooks.

While both FastExcel and IronXL are capable libraries for working with Excel files in C#, IronXL is a top choice due to its ease of use, affordability, and lightweight nature.

Conclusion

In conclusion, when comparing FastExcel and IronXL, it is clear that both libraries offer a range of powerful tools and features for manipulating Excel files using C# code. However, there are some key differences between the two libraries that make IronXL the preferred choice for many developers.

From a technical standpoint, IronXL offers a more intuitive and user-friendly API, making it easier to learn and use for developers of all skill levels. IronXL also offers a lightweight library that does not have the excess bloat that can slow down performance and make it more difficult to manage large Excel workbooks. In contrast, FastExcel focuses more on improving Excel calculation performance, but can be more complex and difficult to work with compared to IronXL.

Additionally, IronXL offers a more affordable licensing model compared to FastExcel, making it a better choice for smaller projects or teams with limited budgets. With a fully licensed version of IronXL, developers have access to all features and tools without any additional fees or restrictions.

Overall, IronXL is the preferred choice for developers who prioritize ease of use, affordability, and lightweight performance. With its powerful tools and features, including multithreaded Excel calculations and support for an unlimited number of worksheets, IronXL is an invaluable tool for any developer working with Excel files in C# code.

For those interested in purchasing IronXL, Iron Software offers a special deal where customers can buy all five of their Iron Software products for the price of two. This includes IronXL, as well as other powerful libraries for working with PDF files, OCR, and more. This deal offers exceptional value for developers who need a range of tools to support their projects.

Download the software product.

< PREVIOUS
EPPlus Read Excel to Datatable C# (IronXL Tutorial)
NEXT >
A Comparison of IronXL and ClosedXML

Ready to get started? Version: 2024.10 just released

Free NuGet Download Total downloads: 1,068,832 View Licenses >