Auto populate a Word document with data from CSV | Python Code

preview_player
Показать описание
Using docxtpl to create word/docx files based on a template docx file.
Python then creates new word/docx files, inserting data, where there is a match between the template and the CSV.
One Docx per row in the CSV.

If you want a fast VPS server with Python installed check out :

I show an example with 6 rows in the CSV, making 6 Docx files, each file has unique content from the CSV.

After a request from a subscriber, I have now added the code to make the filenames based upon values form the CSV.

Modify the numerical filenames system from 1,2,3,4 etc... enumerated sequence to values from 'title' column.

⚪ My subscriber actually sent me the solution before I had chance to work on this, so credit due to suhas g for the following solution:

This is something I didn't add initially as there was a requirement to manually rename the files once I had raised a change reference in another laborious system!

I hope this is useful?

All my GitHub Code :

⚪ If you want a fast VPS server with Python installed check out :

CSV Specific code :

Рекомендации по теме
Комментарии
Автор

* Just a quick note : This only saves to Docx, if you want to save to pdf you will need to run this code and then convert,

python
join shbcf.ru