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.1.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.1.tar.gz.
File metadata
- Download URL: xl2htm-0.1.1.tar.gz
- Upload date:
- Size: 4.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.9.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2141fd561a9eaaed128eae61e9137c88f7e4f81b4b0196e4feeba86fffc53c1d
|
|
| MD5 |
3f078d50488028f581a28bba2722cf19
|
|
| BLAKE2b-256 |
177dd57aaa652e025cf060cc354787c0fc3d3c9d4f6dbedaaf30027c024f9a2e
|
File details
Details for the file xl2htm-0.1.1-py3-none-any.whl.
File metadata
- Download URL: xl2htm-0.1.1-py3-none-any.whl
- Upload date:
- Size: 5.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.9.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
97213b38b291e8eafcc3c653b0df05663df536a9afed8bffca3e9159c1206ddb
|
|
| MD5 |
12415cbb49eaed52446e42e592e30ed4
|
|
| BLAKE2b-256 |
c4732f847ec6eab429e552a026bf319203199c7636ed0ea5002e7a89fbaca6c0
|