Python script to substitute several tags on a template with data for different recipients at the same time.
Have you ever need to create several texts from a template with some fields to customize? With this script you can.
- Ensure you have installed Python version 2.7.14 or more. Otherwise, go to the downloads page and install it.
- Write the text you want on the letter_template.txt file and place some tags like [placeholder tag] or <placeholder tag> in the text (whatever string you want).
<tag_0> Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam eget tortor odio. <tag_1> Interdum et malesuada fames ac ante ipsum primis in faucibus. Aenean vel orci volutpat, varius risus quis, accumsan dui. <tag_2>
- Copy each different tag on the tags.txt file, one on each line.
<tag_0> <tag_1> <tag_2>
- Write the substitution data on the data.txt file, one line for each tag, and as many groups as the number of different recipients.
data 0 tag 0 data 0 tag 1 data 0 tag 2 data 1 tag 0 data 1 tag 1 data 1 tag 2 data 2 tag 0 data 2 tag 1 data 2 tag 2
- Double click letterhelper.py file.
- You will get as many txt files as groups of data you entered on data.txt file, named as: number (starting at 1), dot, blank space, and the info of the first tag.
1. data 0 tag 0.txt 2. data 1 tag 0.txt 3. data 2 tag 0.txt
This script is licensed under The Unlicense.