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.2.tar.gz (9.2 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.2-py3-none-any.whl (5.1 kB view details)

Uploaded Python 3

File details

Details for the file xl2htm-0.1.2.tar.gz.

File metadata

  • Download URL: xl2htm-0.1.2.tar.gz
  • Upload date:
  • Size: 9.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.3

File hashes

Hashes for xl2htm-0.1.2.tar.gz
Algorithm Hash digest
SHA256 7969e0cc26891445e8b88841dec7cc55a5fea059f549635947f98947849f2309
MD5 2f2843490708084efa85aaede705922b
BLAKE2b-256 f0be762fd9b0ade003b2be4112f755aea8de0d4abed9b83ccab511ab14bf715a

See more details on using hashes here.

File details

Details for the file xl2htm-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: xl2htm-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 5.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.3

File hashes

Hashes for xl2htm-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 2cc58b5e5ba1aa6fe07fca20d400b016503e0f025190c8274263a65aed656a9d
MD5 36da0104fbaa42e2c421a4813acfbbbc
BLAKE2b-256 14ab589bf06aef164d6ce754a213bfcd23357c2beb7ac8301b8ec8eec0cffc7e

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