so I use docxptl to automate the process of making invoices. but, it does not input to my word file. i already follow the tutorial thoroughly, but it does not change anything. here is my code :
from docxtpl import DocxTemplate
import csv
appt_item = input("Masukan Nama : ")
list_print_bill = []
with open("./xxx/xxx.csv", 'r', newline='') as file:
reader = csv.DictReader(file)
for row in reader:
if row['Appt'] == appt_item:
list_print_bill.append(appt_item)
list_print_bill.append(row['Patient'])
list_print_bill.append(row['Medical Treatment'])
list_print_bill.append(row['Date'])
with open("./xxx/xxx.csv", 'r', newline='') as file:
reader = csv.DictReader(file)
obat = row['Medical Treatment']
for row in reader:
if row['Medical Treatment'] == obat:
list_print_bill.append(row['Price'])
tuple_data = tuple(list_print_bill)
print(tuple_data)
doc=DocxTemplate("./xxx/xxx.docx")
for value_tuple in tuple_data[0:]:
doc.render({"APPT": value_tuple[0],
"PATIENT":value_tuple[1],
"MEDICAL TREATMENT": value_tuple[2],
"DATE": value_tuple[3],
"PRICE": value_tuple[4],
})
doc.save("Invoice.docx")
Here is my docx file :
It did generate a new file but nothing change. Is there anything that I do wrong here?