Skip to content

south-bend-code-works/sheet-image-handler

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Sheet Image Handler

📊 A Python module for handling embedded images in spreadsheets.
Currently supports Excel (OpenPyXL), with Google Sheets support coming soon.

📦 Installation

Install from GitHub (Recommended)

pip install git+https://github.com/sbcodeworks/sheet-image-handler.git

Install from Local Clone

git clone https://github.com/sbcodeworks/sheet-image-handler.git
cd sheet-image-handler
pip install .

🚀 Usage

from openpyxl import Workbook
from PIL import Image
from sheet_image_handler import SheetImageHandler

# Create a new Excel workbook & sheet
wb = Workbook()
ws = wb.active

# Initialize the handler
handler = SheetImageHandler(ws)

# Load an image and write it to a cell
img = Image.open("example.png")
handler.write("A1", img)

# Save the workbook
wb.save("output.xlsx")

# Check if an image is in a cell
print(handler.image_in("A1"))  # True

# Retrieve and show an image from a cell
retrieved_img = handler.get("A1")
retrieved_img.show()

# Remove an image
handler.remove("A1")

🛠 Features

✅ Load existing images from an Excel sheet
✅ Add new images to a specified cell
✅ Retrieve images from a cell as a PIL Image
✅ Remove images from a sheet

📌 Roadmap

  • Google Sheets support (using gspread)
  • More advanced image manipulation (resize, scaling, auto-alignment)
  • Multi-format support

📚 Running Tests

To run the test suite, ensure you have pytest installed:

pip install pytest

Then, navigate to the project root and run:

pytest tests/

For detailed output, use:

pytest -v tests/

To run a specific test:

pytest tests/test_sheet_image_handler.py::test_function_name

To check test coverage (requires pytest-cov):

pip install pytest-cov
pytest --cov=sheet_image_handler tests/

Happy testing! 🚀

📄 License

This project is licensed under the MIT License.


🏠 Contributing

Pull requests are welcome! To contribute:

  1. Fork the repo
  2. Create a new branch (git checkout -b feature-new)
  3. Commit changes (git commit -m "Add new feature")
  4. Push to the branch (git push origin feature-new)
  5. Open a Pull Request

Happy coding! 🚀

About

A Python module for easily handling embedded images in spreadsheets.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages