DEV Community

Rahul Gurujala
Rahul Gurujala

Posted on

Introducing ExcelHelper: Simplify Your Excel Operations in Python

Hey Python enthusiasts! 👋

I'm excited to share a new open-source library I've been working on: ExcelHelper.
If you've ever found yourself wrestling with Excel files in Python, this library might just make your life a whole lot easier.

What is ExcelHelper?

ExcelHelper is a Python library that simplifies Excel manipulation using the openpyxl library. It provides an intuitive interface for common Excel operations, making it easier to work with spreadsheets programmatically.

Key Features:

  • 📁 Easy workbook handling (open, create, save)
  • 📊 Simplified cell, row, and column operations
  • 🔢 Range operations for bulk data handling
  • 📐 Formula support with automatic cell reference adjustment
  • 📊 Built-in Excel functions (SUM, AVERAGE, COUNT, IF, VLOOKUP)
  • 🎨 Easy style application (fonts, colors, alignments)
  • 📏 Auto-fit columns

Why ExcelHelper?

  1. Simplicity: Perform complex Excel operations with just a few lines of code.
  2. Readability: Your code remains clean and easy to understand.
  3. Time-saving: Reduce the time spent on Excel-related tasks in your Python projects.

Quick Example:

from excel_helper import ExcelHelper

excel = ExcelHelper("example.xlsx")
excel.create_new_workbook()

# Write data
excel.write_range(1, 1, [
    ["Product", "Quantity", "Price"],
    ["Apple", 10, 0.5],
    ["Banana", 15, 0.3],
    ["Orange", 8, 0.7]
])

# Calculate totals
excel.set_formula(2, 4, "=B2*C2")
excel.set_formula(3, 4, "=B3*C3")
excel.set_formula(4, 4, "=B4*C4")

# Sum quantities and totals
excel.sum_range(2, 2, 4, 2, 5, 2)  # Quantities
excel.sum_range(2, 4, 4, 4, 5, 4)  # Totals

excel.auto_fit_columns()
excel.save_workbook()
Enter fullscreen mode Exit fullscreen mode

Getting Started:

Install with pip:

pip install excel-helper
Enter fullscreen mode Exit fullscreen mode

Links:

Check out the GitHub repo for more examples and documentation. You can also find the package on PyPI for easy installation.

I'd love to hear your thoughts and feedback! Feel free to ask any questions or share your experience if you give it a try.

Happy coding! 🐍📊

Top comments (0)