Excel Utilities

check_excel_dependencies

Check if the required Excel dependencies (openpyxl and pillow) are installed.

Returns

  • bool: True if dependencies are installed, False otherwise.

Example

from bigdata_research_tools.excel import check_excel_dependencies

if not check_excel_dependencies():
    print("Please install Excel dependencies: pip install bigdata_research_tools[excel]")

ExcelManager

Class for managing Excel workbook operations, formatting, and branding.

Parameters (constructor)

  • min_column_width (int): Minimum column width (default: 12).
  • max_column_width (int): Maximum column width (default: 75).
  • row_offset (int): Row offset for data (default: 3).
  • column_offset (int): Column offset for data (default: 1).

Key Methods

  • save_workbook(df_args, workbook_path): Save DataFrames to an Excel workbook.
  • beautify_workbook(workbook_path): Apply formatting to an Excel workbook.

Example

from bigdata_research_tools.excel import ExcelManager
import pandas as pd

df = pd.DataFrame({"A": [1, 2], "B": [3, 4]})
excel_manager = ExcelManager()
excel_manager.save_workbook(
    df_args=[(df, "Sheet1", (0, 0))],
    workbook_path="output.xlsx"
)