How to Automate Word Documents from Excel CSV Using Python

Опубликовано: 29 Июнь 2020
на канале: jobstr
691
11

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.

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:

✅ Using pandas dataframe, df.loc, it is fairly trivial, just select the row/column with [:, 'title']

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!

--------------------------------------------------------------------
If you need a good proxy, I can recommend this one 👍👍👍
🌏 https://www.scraperapi.com?fpr=ken49
Coupon Code: DRPI10
-------------------------------------------------------------------

Credit : Eric Lapouyade https://docxtpl.readthedocs.io/en/lat... #docxtpl

Dr Pi
GitHub Code : https://github.com/RGGH/pydoc

☕️☕️☕️ Buy Dr Pi a Coffee...or Tea! : https://www.buymeacoffee.com/DrPi ☕️☕️☕️


На этой странице сайта вы можете посмотреть видео онлайн How to Automate Word Documents from Excel CSV Using Python длительностью часов минут секунд в хорошем качестве, которое загрузил пользователь jobstr 29 Июнь 2020, поделитесь ссылкой с друзьями и знакомыми, на youtube это видео уже посмотрели 691 раз и оно понравилось 11 зрителям. Приятного просмотра!