Skip to main content

Create xlsx-tables from html-tables

Project description

jinja2xlsx

Create xlsx-tables from html-tables

Example

Given html table str

When render html to xlsx

Then result xlsx has table values

from jinja2xlsx import render_xlsx
from openpyxl import Workbook

html_str = """<!DOCTYPE html>
<html lang="en">
    <head>
        <meta charset="UTF-8">
        <title>Simple table</title>
    </head>
    <body>
        <table>
            <tbody>
                <tr>
                    <td>1</td>
                    <td>2</td>
                </tr>
                <tr>
                    <td>3</td>
                    <td>4</td>
                </tr>
            </tbody>
        </table>
    </body>
</html>"""

workbook: Workbook = render_xlsx(html_str)
assert tuple(workbook.active.values) == ((1, 2), (3, 4))

Installation

pip install jinja2xlsx

For images support:

pip install jinja2xlsx[pil]

Development

Install dependencies:

poetry install

For images support:

poetry install -E pil

Run tests and linting:

pre-commit run -a

Install pre-commit hooks:

pre-commit install

Extra

Publish to PyPI

poetry publish --build

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

jinja2xlsx-1.2.0.tar.gz (8.3 kB view details)

Uploaded Source

Built Distribution

jinja2xlsx-1.2.0-py3-none-any.whl (10.0 kB view details)

Uploaded Python 3

File details

Details for the file jinja2xlsx-1.2.0.tar.gz.

File metadata

  • Download URL: jinja2xlsx-1.2.0.tar.gz
  • Upload date:
  • Size: 8.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.2 CPython/3.7.1 Windows/10

File hashes

Hashes for jinja2xlsx-1.2.0.tar.gz
Algorithm Hash digest
SHA256 3604d69d02a9a57625c135293fb68bf22a3089f734d59f7bc41e4fe77854d61e
MD5 591c6dce464c46504b9e6ee9dc473f43
BLAKE2b-256 3051ecd350bde40021eee6b3bcae2785a9bcce1636ccacfebdab019895929240

See more details on using hashes here.

File details

Details for the file jinja2xlsx-1.2.0-py3-none-any.whl.

File metadata

  • Download URL: jinja2xlsx-1.2.0-py3-none-any.whl
  • Upload date:
  • Size: 10.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.2 CPython/3.7.1 Windows/10

File hashes

Hashes for jinja2xlsx-1.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 87826a863febc53c76d1090acbefe94be36bfafea6d29e0b1a49f470f9281614
MD5 31c77771466a911a56351acce04acbdc
BLAKE2b-256 5f323fe194c8e3941b97757ee7a87832f584e0a1b9923776ca5faa70c0607aa9

See more details on using hashes here.

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