Spreadsheets are essential for many businesses and organizations, helping to keep data organized and easy to understand. But even simple tasks like merging cells can sometimes be tricky and time-consuming. That’s where FileFormat.Cells comes in. It’s a real lifesaver when it comes to handling spreadsheets. In this blog post, we’ll show you how FileFormat.Cells makes merging cells easy for everyone, whether you’re a spreadsheet pro or just getting started.

We will conver the following topics in this blog post:

What is FileFormat.Cells?

Let’s take a quick look at FileFormat.Cells. It’s a handy C# tool designed for working with Excel files right in your programming projects. You can do a bunch of things with it, like creating new Excel files or opening existing ones, adding sheets to your workbook, dressing up your data with style formatting, merging cells, putting in formulas, and more. It’s pretty much a one-stop shop for automating all sorts of Excel tasks

Installing the C# Excel API

Before You Start: Just make sure you’ve got .NET Framework installed. That’s all you need before getting started with FileFormat.Cells for easy spreadsheet tasks.

There are two simple ways to get this Excel XLSX API. You can either download it from the NuGet package or just run this command in the NuGet Package Manager:

Install-Package FileFormat.Cells

C# Simple Excel XLSX API - Feature Exploration

After a successful installation, you can start using the functionalities offered by FileFormat.Cells. Since it is an open-source C# Excel API, you can extend its features stack as per your business requirements. So, the current version of FileFormat.Cells is 23.11.0 and it offers various features and some of them are listed below:

  • Users can create an empty Excel XLSX Workbook and add as many worksheets as need. Please see below code example for adding worksheets in the workbook.

  • FileFormat.Cells makes it super easy to protect your sheets. Check out this example to see how you can quickly protect a worksheet in your workbook.

  • This C# Excel API lets you load spreadsheets and easily get info like images, text, and more from the worksheet’s data etc.

Merge Cells in Spreadsheets

Merging cells in spreadsheets is a common task that can enhance the visual appeal and organization of your data. With FileFormat.Cells, the process becomes not only straightforward but also highly customizable. Let’s explore the detailed steps to effortlessly merge cells in spreadsheets using FileFormat.Cells.

To merge two cells in a worksheet, just follow these easy steps:

  • Start by creating a new workbook or opening an existing one.
  • Load the worksheet where you want to merge cells.
  • Use the MergeCells method in the worksheet class. Just give it the references for the first - and last cells you want to merge.
  • Once merged, you can add content using the reference of the top-left cell.

Take a look at this example to see how it’s done in a workbook’s worksheet.

By following these detailed steps, you can leverage FileFormat.Cells to merge cells in spreadsheets with precision and efficiency, enhancing the overall presentation and accessibility of your data.

Real-World Use Case Example

Consider a scenario where you have a spreadsheet containing quarterly financial data. You want to create a summary for each quarter by merging cells to display key metrics prominently. Using FileFormat.Cells, you can automate this process, saving valuable time and reducing the likelihood of errors. The library’s capabilities empower you to focus on the insights derived from the data rather than getting bogged down by manual formatting tasks.


In the ever-evolving landscape of spreadsheet management, tools like FileFormat.Cells emerge as invaluable assets. The ability to effortlessly merge cells not only streamlines your workflow but also enhances the visual appeal and clarity of your spreadsheets. By following the simple steps outlined in this blog post, users can harness the power of FileFormat.Cells to make cell merging a seamless part of their spreadsheet management routine. Embrace efficiency and precision in your data handling – try FileFormat.Cells today and experience a new level of simplicity in spreadsheet manipulation


As FileFormat.Cells for .NET stands as an open-source venture, accessible via GitHub, community contributions are sincerely welcomed and greatly valued.

Ask a Question

You can let us know about your questions or queries on our forum.


What file formats does FileFormat.Cells support?

FileFormat.Cells currently supports (.xlsx) format only.

Does FileFormat.Cells support batch processing for merging cells?

Yes, FileFormat.Cells supports batch processing, allowing users to merge cells within a range in a sheet. This feature enhances efficiency when dealing with large datasets or complex spreadsheet structures.