📅  最后修改于: 2023-12-03 15:20:33.783000             🧑  作者: Mango
Tempa-xlsx is a Python library for generating Excel files from templates. With Tempa-xlsx, you can easily create Excel files with a pre-defined structure and fill them with data.
The following example demonstrates how to generate an Excel file from a template:
from tempa_xlsx import Template
# Define template
template = Template.from_file("template.xlsx")
# Set variables
variables = {
"name": "John Doe",
"age": 30,
"email": "john.doe@example.com"
}
# Render template
output = template.render(variables)
# Save Excel file
output.save("output.xlsx")
In the above example, we first define a template by loading it from a file. We then set variables that will be used to fill in the template. Finally, we render the template with the variables and save the resulting Excel file.
Tempa-xlsx can be installed using pip:
pip install tempa_xlsx
For more information on how to use Tempa-xlsx, please refer to the documentation.
With Tempa-xlsx, generating Excel files from templates has never been easier. Give it a try and see how it can simplify your Excel file generation workflow.