Skip to content

kill-2/xl2htm

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

About

Convert Excel file to HTML (Support merged cells and hidden rows/columns)

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages