Convert Excel file to HTML (Support merged cells and hidden rows/columns)
Project description
xl2htm
- Converts Excel files (.xlsx, .xls) to HTML
- Preserves merged cells with
rowspanandcolspanattributes - Handles hidden rows and columns correctly
- Generates standalone HTML files with minimal styling
Installation
Install from PyPI:
pip install xl2htm
Or with uv:
uv pip install xl2htm
Usage
CLI
options:
excel_file: Path to the Excel file (.xlsx or .xls)-s, --sheets: List of sheet names to convert (if not specified, all sheets are converted)
for exmaple:
xl2htm spreadsheet.xlsx -s Sheet1 Sheet2 > output.html
As a Package
Import and use in Python:
from xl2htm import excel_to_html
# Convert all sheets to HTML
html = excel_to_html('spreadsheet.xlsx')
print(html)
Convert specific sheets:
from xl2htm import excel_to_html
html = excel_to_html('spreadsheet.xlsx', sheet_names=['Sheet1', 'Sheet2'])
print(html)
Get individual sheet objects:
from xl2htm import extract_sheets, extract_sheet
# Extract all sheets
sheets = extract_sheets('spreadsheet.xlsx')
for sheet in sheets:
print(f"Sheet: {sheet.name}")
print(f"Rows: {sheet.rows_count()}, Columns: {sheet.columns_count()}")
# Extract a single sheet by name
sheet = extract_sheet('spreadsheet.xlsx', 'Sheet1')
html_table = sheet.table()
License
MIT
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
xl2htm-0.1.0.tar.gz
(4.9 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file xl2htm-0.1.0.tar.gz.
File metadata
- Download URL: xl2htm-0.1.0.tar.gz
- Upload date:
- Size: 4.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.7.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
af18d074470fee6d82758005892892bb13866fa642bd383530ef140813a4f878
|
|
| MD5 |
91c676bad2d4993d4dc6a9bb745cea54
|
|
| BLAKE2b-256 |
9266f343fd5ff36d826e74463a2b37d728327aafb11aa54e01a47b7e4130012d
|
File details
Details for the file xl2htm-0.1.0-py3-none-any.whl.
File metadata
- Download URL: xl2htm-0.1.0-py3-none-any.whl
- Upload date:
- Size: 5.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.7.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
328bf4ced0efcae3eb397f3e596492c16d28fc8a91a85e8ba3caedfb945c1327
|
|
| MD5 |
e6332d7421c5604d308ab2d2620d871e
|
|
| BLAKE2b-256 |
57507e1ebe6e9fdeb57c374cc938ba801323aad2a3d52c58c2096746bd4cedd0
|