Skip to main content

A Python utility to convert Excel sheets to HTML files, with options to include formulas, grid labels, and cell titles.

Project description

xlsx-to-html-extractor

xlsx-to-html-extractor is a Python utility that converts Excel sheets to HTML files. It provides options to include formulas, grid labels, and cell titles.

Features

  • Convert Excel sheets to HTML files.
  • Option to include formulas in the HTML output.
  • Option to add grid labels (row and column numbers).
  • Option to add cell titles showing the cell addresses.

Installation

You can install the package using pip:

pip install xlsx-to-html-extractor`` 

Usage

Basic Usage

Here's a basic example of how to use the XlsxExtractor class:

from xlsx_to_html_extractor import XlsxExtractor

# Initialize the extractor
extractor = XlsxExtractor(
    source_xlsx='data.xlsx',
    dest_html_file='result.html',
    show_formulas=False,
    grid_labels=True,
    cell_titles=True
)

# Extract the data and save to HTML
extractor.extract()` 

Parameters

  • source_xlsx: Path to the source Excel file.
  • dest_html_file: Path to the destination HTML file.
  • show_formulas: Boolean flag to include formulas in the HTML output.
  • grid_labels: Boolean flag to add grid labels (row and column numbers).
  • cell_titles: Boolean flag to add cell titles showing the cell addresses.

Examples

Including Formulas

To include formulas in the HTML output, set show_formulas to True:

from xlsx_to_html_extractor import XlsxExtractor

extractor = XlsxExtractor(
    source_xlsx='data.xlsx',
    dest_html_file='result.html',
    show_formulas=True,
    grid_labels=True,
    cell_titles=True
)

extractor.extract()

Adding Grid Labels

To add grid labels (row and column numbers), set grid_labels to True:

from xlsx_to_html_extractor import XlsxExtractor

extractor = XlsxExtractor(
    source_xlsx='data.xlsx',
    dest_html_file='result.html',
    show_formulas=False,
    grid_labels=True,
    cell_titles=False
)

extractor.extract()

Adding Cell Titles

To add cell titles showing the cell addresses, set cell_titles to True:

from xlsx_to_html_extractor import XlsxExtractor

extractor = XlsxExtractor(
    source_xlsx="data.xlsx",
    dest_html_file="result.html",
    show_formulas=False,
    grid_labels=False,
    cell_titles=True
)
extractor.extract()

License

This project is licensed under the MIT License.

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

xlsx_to_html_extractor-0.1.0.tar.gz (3.6 kB view hashes)

Uploaded Source

Built Distribution

xlsx_to_html_extractor-0.1.0-py3-none-any.whl (4.1 kB view hashes)

Uploaded Python 3

Supported by

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