Skip to main content

oj

Reading excel (but more than just cell values: Also colors

To install: pip install oj

Overview

The oj package provides advanced functionalities for reading Excel files using Python, focusing not only on cell values but also on extracting and manipulating cell styles, colors, and formats. It utilizes libraries such as pandas, numpy, and openpyxl to handle and process Excel files in a more detailed manner.

Features

  • Loading Excel Sheets: Load specific sheets from Excel files with ease.
  • Style Extraction: Extract styles from cells including fonts, fills, borders, and more.
  • Data Manipulation: Functions to manipulate and filter data based on cell values and styles.
  • Integration with Pandas: Seamlessly convert Excel data into pandas DataFrames with additional style information.

Installation

To install the package, use the following pip command:

pip install oj

Usage

Loading and Reading Excel Sheets

To load an Excel sheet and read data:

from oj import get_sheet_data

# Load a specific sheet from the Excel file
sheet = get_sheet_data('path_to_file.xlsx', 'Sheet1')

Extracting All Cell Styles

To extract styles from all cells in a given sheet:

from oj import extract_all_cell_styles

# Assuming 'sheet' is already loaded
styles_df = extract_all_cell_styles(sheet)
print(styles_df.head())

Appending Styles to DataFrame

To append style information to an existing DataFrame:

from oj import append_styles_to_dataframe

# Assuming 'sheet' is loaded and 'df' is a DataFrame with coordinates
styled_df = append_styles_to_dataframe(sheet, df)
print(styled_df)

Filtering DataFrame by Value and Style

To filter a DataFrame based on cell values and specific style properties:

from oj import filter_df_by_value_and_style

# Create a sample DataFrame
df = pd.DataFrame({
    'coordinate': ['A1', 'A2'],
    'value': ['Hello', 'World'],
    'font': ['Arial', 'Calibri'],
    'fill': ['Yellow', 'Blue']
})

# Filter by value and font style
filtered_df = filter_df_by_value_and_style(df, value='Hello', style_property='font', style_value='Arial')
print(filtered_df)

Documentation

Each function in the oj package is documented with docstrings, providing a clear description of its functionality, parameters, and usage examples. This ensures ease of use and understanding of the available methods.

Contributing

Contributions to the oj package are welcome. Please ensure that any pull requests or issues are clear and provide sufficient information for review.

Metadata

Release files for oj 0.0.5

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for oj 0.0.5
File Size Uploaded
oj-0.0.5.tar.gz 8.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for oj 0.0.5
File Interpreter ABI Platform
oj-0.0.5-py3-none-any.whl Python 3 none any Details

Total release size: 16.4 kB

Release files / oj-0.0.5.tar.gz

Download URL oj-0.0.5.tar.gz
Size 8.3 kB
Tags Source
SHA-256 checksum
How to use checksums
f2c8030012bf4b55812928bfe664869900cdf4fb195f6a1c7c1c9fe80048a639
BLAKE2b-256 checksum
How to use checksums
cf1deef80d84dd6c0463796f562a666eaac00dbfd798a7c620096178e72345f5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.10.10 {"installer":{"name":"uv","version":"0.10.10","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release files / oj-0.0.5-py3-none-any.whl

Download URL oj-0.0.5-py3-none-any.whl
Size 8.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
e39128845d848566ad86107ddacba9e098beaa9e7c2952377a2540296455265f
BLAKE2b-256 checksum
How to use checksums
eaa7dc62e12a8e40687a5cf03ef1dbaa376b419ae547df39ad02360244d8445f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.10.10 {"installer":{"name":"uv","version":"0.10.10","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release history Release notifications | RSS feed

This release

0.0.5 This release

2 release files

0.0.4

2 release files

0.0.3

2 release files

0.0.2

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page