Skip to main content

SheetPictureFinder is a pure Python utility for extracting images from Excel .xlsx files — specifically from worksheets and cell addresses. It parses the internal XML structure of Excel files and maps embedded images to their anchor locations.

Project description

📦 SheetPictureFinder

SheetPictureFinder is a pure Python utility for extracting images from Excel .xlsx files — specifically from worksheets and cell addresses. It parses the internal XML structure of Excel files and maps embedded images to their anchor locations.


✨ Features

  • ✅ Extract images anchored to specific cells (e.g., H2, H3)
  • ✅ Supports file paths and io.BytesIO streams
  • ✅ Lazy image loading — images loaded only when requested
  • ✅ List image-bearing cells by sheet or across workbook
  • ✅ Cross-platform temporary file handling
  • cleanup() method for managing resources

📦 Dependency

No need for openpyxl or openpyxl-image-loader. Just have your pillow installed.

pip install pillow

• Python 3.8+

📦 Installation

pip install sheetpicturefinder

🚀 Usage Example

from PIL import Image
from sheetpicturefinder import XLSXPictureFinder  # Replace with actual import path

# Load XLSX from file path
finder = XLSXPictureFinder("/Users/ss/Downloads/SampleFile.xlsx")

# 1. List all image cells in 'EXTERIOR' sheet
image_cells = finder.list_image_cells("EXTERIOR")
print("Image cells in 'EXTERIOR':", image_cells)

# 2. Load and display an image at a specific cell
if 'H2' in image_cells:
    image = finder.get_image("EXTERIOR", "H2")
    if image:
        image.show()
    else:
        print("No image found at EXTERIOR!H2")
else:
    print("H2 not in image cells for EXTERIOR")

# 3. List all image-containing cells across all sheets
all_images = finder.list_all_sheet_image_cells()
print("\nAll image cells in workbook:")
for sheet, cells in all_images.items():
    print(f"  {sheet}: {cells}")

# 4. Clean up temporary files
finder.cleanup()

🧰 API Reference

XLSXPictureFinder(xlsx_source) • xlsx_source: Path to .xlsx file or io.BytesIO stream

get_image(sheet_name, cell_address)PIL.Image or None

Loads and returns the image anchored at cell_address in sheet_name.

list_image_cells(sheet_name)List[str]

Returns a list of cell addresses that contain images in the given sheet.

list_all_sheet_image_cells()Dict[str, List[str]]

Returns all sheets and their image-bearing cells:

{
    'EXTERIOR': ['H2', 'H3'],
    'APPLIANCES': ['H4']
}

📘 License

MIT License — free to use, modify, and distribute.

🧠 Author’s Note

This library bypasses heavyweight Excel parsing and directly inspects the underlying structure of .xlsx files. It’s optimized for performance, memory, and flexibility — ideal for image extraction in automation pipelines or reporting tools.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

sheetpicturefinder-1.0.0.tar.gz (5.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

sheetpicturefinder-1.0.0-py3-none-any.whl (5.8 kB view details)

Uploaded Python 3

File details

Details for the file sheetpicturefinder-1.0.0.tar.gz.

File metadata

  • Download URL: sheetpicturefinder-1.0.0.tar.gz
  • Upload date:
  • Size: 5.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.9.6

File hashes

Hashes for sheetpicturefinder-1.0.0.tar.gz
Algorithm Hash digest
SHA256 71690418779914488d8d15aa45b934bbc0aebb63f71da147ac87d119a7909ab7
MD5 bf27e4082bfd835e333421f3ca1ebe9f
BLAKE2b-256 8df892be948a92a34b9f9a1dc0c7bd64442d043e6d4ffd86dfd72c3b2734154e

See more details on using hashes here.

File details

Details for the file sheetpicturefinder-1.0.0-py3-none-any.whl.

File metadata

File hashes

Hashes for sheetpicturefinder-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 d0dcdd6dd13b21bd36ba0001b29a6cdb7177cb3a7488f6fcb0001f842a26c72e
MD5 c452d4cb9048a6fbd3c3d1f09b23087d
BLAKE2b-256 dd38b87ae6f01da615557c8d34ae51d8c9cb3d99d7ee66e33e1b6c5bb55b09bc

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page