Add mail merge script with sample names and letter template

This commit is contained in:
2026-10-13 14:09:26 +08:00
parent 783657cf0c
commit d53af18f8a
11 changed files with 84 additions and 0 deletions
+13
View File
@@ -0,0 +1,13 @@
PLACEHOLDER = "[name]"
with open("Input/Names/invited_names.txt") as names_file:
names = names_file.readlines()
with open("Input/Letters/starting_letter.txt") as letter_file:
letter_contents = letter_file.read()
for name in names:
stripped_name = name.strip()
new_letter = letter_contents.replace(PLACEHOLDER, stripped_name)
with open(f"Output/ReadyToSend/letter_for_{stripped_name}.txt", "w") as completed_letter:
completed_letter.write(new_letter)