Skip to content

Fill variables (of a given dataset input) into Merge Fields of a Microsoft Word template using Mail Merge library in Python.

Notifications You must be signed in to change notification settings

roboes/business-card-generator

Repository files navigation

Business Card Generator

Description

This tool aims to fill variables (of a given dataset input) into Merge Fields of a Microsoft Word template using Mail Merge library in Python. The main features are:

  • Fill/populate Merge Fields from a Microsoft Word file (.docx) from a given dataset (an example is provided in the business-card-generator.py code).
  • In case of more than 10 rows are contained in the input dataset, the template is replicated into multiple pages.

Output

Two Microsoft Word (.docx) templates are provided:

  1. Simple Business Card Template

Output

  1. Wedding Business Card Template (required font: Angella White Font).

Output

Usage

Python dependencies

python -m pip install docx-mailmerge openpyxl pandas

Functions

business_card_generator

business_card_generator(df, template, output_name)

Description

  • Fill variables (of a given dataset input) into Merge Fields of a Microsoft Word template.

Parameters

  • df: DataFrame. The DataFrame should include a name column, with the names that will be inserted to the Word template file.
  • template: str, path object or file-like object. Word template input file.
  • output_name: str, path object or file-like object. Output of the transformed Word template input file.

About

Fill variables (of a given dataset input) into Merge Fields of a Microsoft Word template using Mail Merge library in Python.

Resources

Stars

Watchers

Forks

Languages