Answer the question
In order to leave comments, you need to log in
Formation of a document according to a template?
Good day!
The essence of the question is as follows:
1. There is a data source - a database on MySQL (or you can upload it to EXCEL)
2. There is a WORD template in which you need to insert data.
But there is one problem. In all the examples on the Internet, the WORD template is filled in once, but I need it to be replenished depending on the amount of data.
Example:
There is a template (in the screenshot)
But you need to create as many tables as in the screenshot in the finished report as there are rows in EXCEL. (Or in the case of a data source - a database, how many client IDs we will pass to the script.) That is, at the stage of writing automation, we do not know this.
I tried to make it a Python script, but I don't know how to add a new template table on a new loop step in the same document. It's the same with the Mail Merge feature in Word tools.
Please tell me if there is a solution. Thanks in advance!
Answer the question
In order to leave comments, you need to log in
You can use the python-docx library to generate the document.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question