Remove Image Background in Excel using C# REST API

This article guides on how to remove image background in Excel using C# REST API. You will learn to remove picture background in Excel using C# REST Interface by utilizing a .NET-based Cloud SDK. It will also assist you in removing the background from an individual worksheet.

Prerequisite

Steps to Remove Picture Background in Excel using C# REST Interface

  1. Set up the CellsApi object using your client ID, client secret, and the Aspose Cloud base URL
  2. Open the target Excel file and create an UploadFileRequest to upload it to Aspose Cloud storage
  3. Send the upload request to the cloud using the UploadFile() method of the CellsApi class
  4. Construct a DeleteWorkbookBackgroundRequest object with the file name and default storage/folder settings
  5. Call DeleteWorkbookBackground() with the prepared request to remove the workbook’s background
  6. Use DownloadFileRequest and DownloadFile() to retrieve the modified Excel file from the cloud
  7. Write the downloaded stream to a new local file using FileStream

These steps summarize the process of how to remove image background in Excel using C# RESTful Service. This process connects to Aspose.Cells Cloud using API credentials, uploads an Excel file, and removes its background using a dedicated API request. After the background is removed, the updated file is downloaded and saved locally.

Code to Remove Image Background in Excel using C# REST API

The above code demonstrates the process of how to remove photo background in Excel using C# .NET-based API. This code removes the background image from the entire workbook. If you want to remove the background of a single or selected sheets, you may use the DeleteWorksheetBackground() method that uses the sheet name to remove the background picture.

This article has enlightened us about removing background images from an Excel file. To insert a background image in an Excel file, refer to the article Insert Background Image in Excel using C# REST API.

 English