xHow to get Images from an Excel XLSX Spreadsheet in C# .NET Framework

Trying to deal with Excel format directly in C# is a one-way ticket to Frustration Town, let me tell you. There are so many different elements that interweave to make up a spreadsheet, that dealing with all of them just to extract an image is often not even worth the time and effort. That is, unless you have access to a lovely little API that will get this done for you, instead.

Let’s begin with installing our package, like so:

Install-Package Cloudmersive.APIClient.NET.DocumentAndDataConvert -Version 3.2.8

Now we are going to go ahead with calling our image extraction function:

using System;using System.Diagnostics;using Cloudmersive.APIClient.NET.DocumentAndDataConvert.Api;using Cloudmersive.APIClient.NET.DocumentAndDataConvert.Client;using Cloudmersive.APIClient.NET.DocumentAndDataConvert.Model;namespace Example{public class EditDocumentXlsxGetImagesExample{public void main(){// Configure API key authorization: ApikeyConfiguration.Default.AddApiKey("Apikey", "YOUR_API_KEY");// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed// Configuration.Default.AddApiKeyPrefix("Apikey", "Bearer");var apiInstance = new EditDocumentApi();var input = new GetXlsxImagesRequest(); // GetXlsxImagesRequest | Document input requesttry{// Get images from a Excel XLSX spreadsheet, worksheetGetXlsxImagesResponse result = apiInstance.EditDocumentXlsxGetImages(input);Debug.WriteLine(result);}catch (Exception e){Debug.Print("Exception when calling EditDocumentApi.EditDocumentXlsxGetImages: " + e.Message );}}}}

And just like that, easy.

Image for post

There’s an API for that. Cloudmersive is a leader in Highly Scalable Cloud APIs.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store