Skip to main content

Extract xlsx templates with full visual fidelity and render data-driven reports in xlsx and PDF formats.

Project description

Mindoff Dataport

Build high-fidelity Excel and PDF reports from reusable .xlsx templates.

Mindoff Dataport turns styled Excel workbooks into reusable report templates, compiles runtime data into a portable ReportBundle, and exports .xlsx and .pdf outputs while preserving the layout, structure, and styling you designed.

Coverage Status PyPI version Python

Documentation: https://dataport.mindoff.work

Source: https://github.com/mindoffwork/mindoff-dataport

Key Features

  1. Template-First Report Generation
    Turn real Excel workbooks into reusable report templates without rebuilding layouts in code.

  2. One Bundle, Two Formats
    The same compiled bundle renders to both .xlsx and .pdf. No second pipeline, no separate styling pass.

  3. Dataframes Plug Directly Into Templates
    Connect dataframe inputs directly to templates so report generation fits naturally into modern data workflows.

  4. Streaming for Large Exports
    In streaming mode, Parquet sources are read in batches and rows are written incrementally. Peak memory stays roughly flat as row count grows, instead of climbing with the dataset.

  5. Flexible Repeating and Dynamic Sheets
    Generate repeated sections and dynamic sheets for customer-wise, region-wise, or report-wise output from a single template.

  6. Adjustable Layout at Export Time
    Column occupation, alignment, and collision shifting are configurable at runtime, without touching the original template.

Performance

Streaming mode holds near-constant peak memory regardless of dataset size. These benchmarks compare it against raw openpyxl, xlsxwriter, and ReportLab loops with equivalent layout and styling (the most direct alternative).

XLSX export: export time and peak memory at scale

Fig. 1: XLSX export. Left: wall-clock time for all Mindoff modes; both streaming and fidelity scale O(n) linearly. Right: peak RSS; Mindoff streaming holds near-constant while openpyxl and xlsxwriter raw loops grow with dataset size.

PDF export: export time and peak memory at scale

Fig. 2: PDF export. Left: wall-clock time; linear O(n) scaling. Right: peak RSS; Mindoff streaming vs. ReportLab raw loop.

Scenario Mode Why
≤ 50K rows, full style fidelity export_mode="fidelity" Full merged-cell and style support; no streaming constraints
> 50K rows, XLSX export_mode="streaming" Near-constant memory regardless of row count
Any size, PDF automatic PDF always paginates; no export_mode setting needed
> 1M rows, split output streaming + max_rows_per_workbook Splits output across multiple workbook files

Full methodology, fairness notes, and instructions to reproduce the numbers yourself are in the Benchmarking guide.

Quick Start

Think of it like a mail merge for spreadsheets: you design the layout once in Excel, then the library fills in the data. Every report follows four steps: extract → inspect → compile → export.

1. Install the Package

pip install mindoff-dataport

For dataframe support (Polars DataFrames or LazyFrames):

pip install "mindoff-dataport[polars]"

2. Extract the Template

Read your .xlsx file into a schema. This captures the layout, every style, and the {{key:type}} placeholders you marked in cells. You run this once per template, not once per report.

import polars as pl
from mindoff_dataport import mo_dataport

template = mo_dataport.extract("invoice_template.xlsx")

3. Inspect What the Template Needs

Before you build a payload, ask the template what it expects. Useful when working with a template someone else designed, or coming back to one after a while.

required_inputs = mo_dataport.inputs(template)
# {'Invoice': {'customer_name': 'string', 'invoice_number': 'number', 'line_items': 'dataframe'}}

The result is sheet-scoped: the outer key is the sheet name, and the inner keys are the placeholders on that sheet with their expected types.

4. Compile: Bind Your Data

Hand the template your real data, keyed by sheet name. The library validates it against the contract from step 3 and produces a ReportBundle: a portable artifact you can export immediately or save to disk and export later.

line_items = pl.DataFrame({"item": ["Widget A", "Widget B"], "amount": [125, 275]})

bundle = mo_dataport.compile(
    template,
    data={
        "Invoice": {
            "customer_name": "Acme Industries",
            "invoice_number": 1024,
            "line_items": line_items,
        }
    },
)

5. Export

Render the bundle to a file. The same bundle drives both formats. No second pipeline.

mo_dataport.export(bundle, "invoice_filled.xlsx")
mo_dataport.export(bundle, "invoice_filled.pdf", format="pdf")

When you're ready to go further (placeholders, the data contract, streaming, repeats, dynamic sheets, custom fonts, and the full API reference), head to the developer guide.

License

Released 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

mindoff_dataport-1.0.0.tar.gz (345.7 kB view details)

Uploaded Source

Built Distribution

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

mindoff_dataport-1.0.0-py3-none-any.whl (363.4 kB view details)

Uploaded Python 3

File details

Details for the file mindoff_dataport-1.0.0.tar.gz.

File metadata

  • Download URL: mindoff_dataport-1.0.0.tar.gz
  • Upload date:
  • Size: 345.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for mindoff_dataport-1.0.0.tar.gz
Algorithm Hash digest
SHA256 5ed3522f9234013d816ff5f91b4ad5632d14facc3e59cb323c1bffcbe2b24c43
MD5 2a321fff1041b7359aa7cc75b618aa95
BLAKE2b-256 3d66fcc46e72432b1aa0aa377579de39dea60e6f4060008ff76ad9bbe5c3871a

See more details on using hashes here.

Provenance

The following attestation bundles were made for mindoff_dataport-1.0.0.tar.gz:

Publisher: cd.yml on mindoffwork/mindoff-dataport

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file mindoff_dataport-1.0.0-py3-none-any.whl.

File metadata

File hashes

Hashes for mindoff_dataport-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 053f5a9b1c30b653df380be8558d5754a0dd38275a9e8401f3562180cd93486a
MD5 94fcdcee6cfa1d40fc2ffd00977ab287
BLAKE2b-256 76f3f7129e43df2893c202ca5da021611137fb08293160d094882108b40eb934

See more details on using hashes here.

Provenance

The following attestation bundles were made for mindoff_dataport-1.0.0-py3-none-any.whl:

Publisher: cd.yml on mindoffwork/mindoff-dataport

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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