Skip to main content

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 rowspan and colspan attributes
  • 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


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)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

xl2htm-0.1.1-py3-none-any.whl (5.0 kB view details)

Uploaded Python 3

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

Hashes for xl2htm-0.1.1.tar.gz
Algorithm Hash digest
SHA256 2141fd561a9eaaed128eae61e9137c88f7e4f81b4b0196e4feeba86fffc53c1d
MD5 3f078d50488028f581a28bba2722cf19
BLAKE2b-256 177dd57aaa652e025cf060cc354787c0fc3d3c9d4f6dbedaaf30027c024f9a2e

See more details on using hashes here.

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

Hashes for xl2htm-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 97213b38b291e8eafcc3c653b0df05663df536a9afed8bffca3e9159c1206ddb
MD5 12415cbb49eaed52446e42e592e30ed4
BLAKE2b-256 c4732f847ec6eab429e552a026bf319203199c7636ed0ea5002e7a89fbaca6c0

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page