Reports Quickstart


xlwings Reports is an add-on to xlwings PRO and not included in the xlwings PRO base subscription.

xlwings Reports is a solution for template based Excel and PDF reporting. It allows business users without Python knowledge to create & maintain Excel templates without having to go back to a Python developer for every change: xlwings Reports separates the Python code (that gets and prepares all the data) from the Excel template (that defines which data goes where and how it should be formatted). See also the xlwings Reports homepage.

This guide assumes you have xlwings PRO already installed. If that’s not the case, head over to Installation.

Start by creating the following Python script

from xlwings.reports import create_report
import pandas as pd

df = pd.DataFrame(data=[[1,2],[3,4]])
wb = create_report('my_template.xlsx', 'my_report.xlsx', title='MyTitle', df=df)

Then create the following Excel file called my_template.xlsx:


Now run the Python script:


This will copy the template and create the following output by replacing the variables in double curly braces with the value from the Python variable:


Apart from Strings and Pandas DataFrames, you can also use numbers, lists, simple dicts, NumPy arrays, Matplotlib figures and PIL Image objects that have a filename.

By default, xlwings Reports overwrites existing values in templates if there is not enough free space for your variable. If you want your rows to dynamically shift according to the height of your array, use Frames.