Skip to main content

Convert Excel files to Mustache templates based on a defined schema.

Project description

pyexcel2mustache

Convert Excel (xlsx) sheets into Mustache templates based on a defined schema. This is now a distributable Python package.

Features

  • Convert multiple sheets at once using customizable schemas.
  • Skip sheets starting with an underscore (_).
  • Robust and modular architecture following SOLID principles.
  • Easy installation via pip.

Installation

Install the package from the local directory:

pip install .

Once published to PyPI, you can install it using:

pip install pyexcel2mustache

Requirements

  • Python 3.8+
  • Dependencies (automatically installed): openpyxl, pystache

Excel Schema Rules

Each sheet must follow a strict schema for the first 5 rows:

  1. Row 1: Column Description
  2. Row 2: Usage / PrimaryKey indicator ('PrimaryKey' string marks it as primary)
  3. Row 3: Attribute name
  4. Row 4: Data Type
  5. Row 5: Variable Name (the actual identifier used in the template)

Note: Sheets starting with an underscore (_) will be skipped.

Usage

Once installed, use the pyexcel2mustache command in your terminal:

pyexcel2mustache -i <input_excel> -t <template_mustache> -o <output_path> [-c]

Arguments

  • -i, --input: Path to the input Excel file. (Required)
  • -t, --template: Path to the Mustache template file. (Required)
  • -o, --output: Path for the generated output file. (Required)
  • -c, --clean: Clean up/remove existing output file before writing.

Project Structure (Refactored)

The project follows a modular structure:

  • src/pyexcel2mustache/domain: Data models.
  • src/pyexcel2mustache/parsers: Excel parsing logic.
  • src/pyexcel2mustache/renderers: Mustache rendering engine.
  • src/pyexcel2mustache/cli: Command line argument handling.

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

pyexcel2mustache-0.1.1.tar.gz (6.1 kB view details)

Uploaded Source

Built Distribution

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

pyexcel2mustache-0.1.1-py3-none-any.whl (7.3 kB view details)

Uploaded Python 3

File details

Details for the file pyexcel2mustache-0.1.1.tar.gz.

File metadata

  • Download URL: pyexcel2mustache-0.1.1.tar.gz
  • Upload date:
  • Size: 6.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.12

File hashes

Hashes for pyexcel2mustache-0.1.1.tar.gz
Algorithm Hash digest
SHA256 251f9420d873178215f44dea7594f7c1f29ddcff056a7a82cd252ae2694e3169
MD5 52091dceefa517cb3a3582f8db309e12
BLAKE2b-256 db8362dc70c1e70a4597a529911f42e77a9fa8b53fd9580f5ae7f9f518925c0c

See more details on using hashes here.

File details

Details for the file pyexcel2mustache-0.1.1-py3-none-any.whl.

File metadata

File hashes

Hashes for pyexcel2mustache-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 1ebe803b57304976de16ac7640224242ff5f8868fd822b8b47672b8cb2d44bf3
MD5 05115531f64b2d47526d647900bd373c
BLAKE2b-256 eded8d9064adba80b4fcbdd6497f90cb60a6ffe13e76ce6d1f9ed4d1ebcf2fce

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