Merge Cells in Excel using C# REST API

This tutorial guides on how to merge cells in Excel using C# REST API. You will learn to combine cells in Excel using C# Low Code API by using a .NET-based Cloud SDK. It will assist you to merge only rows or columns as per the requirements.

Prerequisite

Steps to Merge Cells using C# RESTful Service

  1. Define the clientID, clientSecret, and apiBaseUrl required to authenticate and connect to Aspose Cloud
  2. Using the credentials and base URL, initialize the CellsApi object for making API calls
  3. Define source Excel file name and remote file names under which the file will be saved in the cloud
  4. Upload the file to Cloud storage using the cellsApi.UploadFile() method
  5. Create a PostWorksheetMergeRequest object, set the start/end cells and merge area size
  6. Execute the request using the PostWorksheetMerge() method
  7. Download the updated Excel file from the Cloud using the DownloadFileRequest

These steps describe how to combine rows in Excel using C# .NET-based API or columns of your choice. The process authenticates with Aspose.Cells Cloud, using provided credentials, uploads a local Excel file to Cloud storage and merges a 4x4 range of cells starting at cell B2 on Sheet1. It then downloads the modified file and saves it local disk.

Code to Merge Cells in Spreadsheet using C# REST Interface

This sample code has demonstrated the process to merge cells using C# REST Interface. You can merge multiple ranges in a loop and also merge cells based on content or formatting by fetching the cell content and formatting. You can merge cells in a single column, such as column B, by setting start column 1 and total columns 1 alongside the number of rows.

This article has taught us the process of merging cells, rows, or columns. To apply auto-filter in an Excel file, refer to the article on Apply filter in Excel using C# REST API.

 Български