Jinja based Excel Template support multiple sheets
Project description
Jinja Excel Template Engine
This package can handle some complicated Excel scenarios. It contains:
- Dynamic sheets based on the data
- Images are inside the Excel file,
- Multiple level of grouping in the data (this library does not handle it, but you can have your own data pipeline to prepare the data.),
- Printing header setting
Concept
Excel templating is always complicated and normal Excel file does not support them. We have to use an intermediate file named ExcelXML.
Data + Jinja Template ---(Jinja Engine)---> ExcelXML ---(Excel Generator)---> Excel
With Data and Jinja Template, the Jinja Engine can generate the ExcelXML, then the Excel Generator can generate the Excel file. An ExcelXML is an XML representing a single Excel file.
The ExcelXML has a specific format, so the Excel Generator can read it and draw the Excel.
Here is an example of the ExcelXML.
<Excel>
<sheet sheetName="myFirstSheet" print_area="A1:L10" print_header="1:3">
<row> <!-- first row -->
<cell value="A1" />
<cell value="A2" />
<cell value="A3" />
</row>
<row /> <!-- second row, empty row -->
<row> <!-- third row -->
<cell value="C1" />
<cell value="C2" />
<cell value="C3" />
</row>
</sheet>
<sheet sheetName="mySecondSheet" print_area="A1:L10" print_header="1:3">
<row> <!-- first row -->
<cell value="A1" />
<cell value="A2" />
<cell value="A3" />
</row>
<row /> <!-- second row, empty row -->
<row> <!-- third row -->
<cell value="C1" />
<cell value="C2" />
<cell value="C3" />
</row>
</sheet>
</Excel>
The Jinja template is to construct the ExcelXML with your own data pipeline.
Sample
Please check the tests/countries.py
. It shows the raw data and group countires by region and display countries in multiple sheets. It also contains some basic diagrams.
Build
poetry build
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for jinja_excel_template-1.0.2.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | fc70de13fbaaeed0955378fbe610b4b338c3f208812a97abe8195223092a293d |
|
MD5 | a1b9125946b29628e331301ff218b121 |
|
BLAKE2b-256 | 2418ce644fa864592aefc8c182c33cd64ceae439f9e1f44887ad4e37640aa9d3 |
Hashes for jinja_excel_template-1.0.2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 618125f28afe16f9e3cc74fef90972a5a4eca93e0a5297fa9ca869be001c3d4b |
|
MD5 | 664416eed78fae2e2478796bf4b1787c |
|
BLAKE2b-256 | 5fb01522bff808059ff4cf3042656c6985ae154b276b54d9316f43f205233de9 |