Extract images from Microsoft Office Excel spreadsheets

View as MarkdownMarkdown

Set up your AI agent

Give your coding agent live access to the GroupDocs documentation and API reference through the GroupDocs Docs MCP server — no install, no API key. Learn more

claude mcp add --transport http groupdocs-docs https://docs.groupdocs.com/mcp

Also process documents locally

The GroupDocs.Parser MCP server lets your agent work with files on your machine; they are never uploaded. It runs in Docker: replace /path/to/documents with the folder it may use.

claude mcp add groupdocs-parser -- docker run --rm -i -v /path/to/documents:/data ghcr.io/groupdocs-parser/parser-net-mcp:latest
Folders, licensing and more →

To extract images from Microsoft Office Excel spreadsheets GetImages methods are used. By default images are extracted with its original format. With using ImageOptions class it is possible to extract images from Microsoft Office Excel spreadsheets as bmp, gif, jpeg, png and webp formats.

Warning
GetImages method returns null value if image extraction isn’t supported for the document. For example, image extraction isn’t supported for CSV files. Therefore, for CSV file GetImages method returns null. If Microsoft Office Excel spreadsheet has no images, GetImages method returns an empty collection.

Here are the steps to extract images from Microsoft Office Excel spreadsheet to PNG-files:

  • Instantiate Parser object for the initial spreadsheet;
  • Call GetImages method and obtain the collection of image objects;
  • Iterate through the collection and save image contents to the file.

The following example demonstrates how to extract images from Microsoft Office Excel spreadsheet:

// Create an instance of Parser class
using (Parser parser = new Parser(filePath))
{
    // Extract images from spreadsheet
    IEnumerable<PageImageArea> images = parser.GetImages();
 
    // Create the options to save images in PNG format
    ImageOptions options = new ImageOptions(ImageFormat.Png);
 
    int imageNumber = 0;
    // Iterate over images
    foreach (PageImageArea image in images)
    {
        // Save the image to the png file
        image.Save(imageNumber.ToString() + ".png", options);
        imageNumber++;
    }
}

More resources

GitHub examples

You may easily run the code above and see the feature in action in our GitHub examples:

Free online document parser App

Along with full featured .NET library we provide simple, but powerful free Apps.

You are welcome to parse documents and extract data from PDF, DOC, DOCX, PPT, PPTX, XLS, XLSX, Emails and more with our free online Free Online Document Parser App.