Тёмный

Automating Word Documents from Excel Using Python | ‘docxtpl’ Tutorial 

Coding Is Fun
Подписаться 96 тыс.
Просмотров 90 тыс.
50% 1

👉 Explore All My Excel Solutions: pythonandvba.com/solutions
𝗗𝗘𝗦𝗖𝗥𝗜𝗣𝗧𝗜𝗢𝗡
▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
Did you know you can use Python code to dynamically create Word Documents? For this tutorial, we will be using the Python libraries ‘xlwings’ & ‘docxtpl’ to automate Word. In particular, we will be writing values from Excel to Word by using Python.
Download all the files from the tutorial:
👉 GitHub: github.com/Sven-Bo/python-wor...
𝗧𝗢𝗢𝗟𝗦 𝗔𝗡𝗗 𝗥𝗘𝗦𝗢𝗨𝗥𝗖𝗘𝗦
▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
🆓【𝗙𝗥𝗘𝗘】Excel Add-in (𝗠𝘆𝗧𝗼𝗼𝗹𝗕𝗲𝗹𝘁): pythonandvba.com/mytoolbelt
📊 Data Visualization Excel Add-In (𝗚𝗿𝗮𝗳𝗹𝘆): pythonandvba.com/grafly
🤪 Fun Emoji Excel Add-In (𝗘𝗺𝗼𝗷𝗶𝗳𝘆): pythonandvba.com/emojify
📑 Excel Templates: pythonandvba.com/go/excel-tem...
🎓 My Courses: pythonandvba.com/go/courses
📚 Books, Tools, and More: pythonandvba.com/resources
𝗖𝗢𝗡𝗡𝗘𝗖𝗧 𝗪𝗜𝗧𝗛 𝗠𝗘
▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
🔗 LinkedIn: / sven-bosau
📸 Instagram: / codingisfun_official
💻 GitHub: github.com/Sven-Bo
💬 Discord: pythonandvba.com/discord
📬 Contact: pythonandvba.com/contact
☕ 𝗕𝘂𝘆 𝗺𝗲 𝗮 𝗰𝗼𝗳𝗳𝗲𝗲?
If you want to support this channel, you can buy me a coffee here: pythonandvba.com/coffee-donation

Опубликовано:

 

30 апр 2021

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 251   
@elsheep6951
@elsheep6951 2 года назад
Clear and concise. Delivers results and contains plenty of explanation to enable the viewer to adapt to their own project. Thank you for an excellent tutorial.
@CodingIsFun
@CodingIsFun 2 года назад
Thank you very much for your generous feedback & the kind words! I am glad you enjoyed it! ❤
@corentindurand6283
@corentindurand6283 3 года назад
Very good, as usual ! I just love the fact that you don't need to be a profesionnal programmer to follow your tutorials. Really accessible with a basic knowledge.
@CodingIsFun
@CodingIsFun 3 года назад
Thank you very much! Glad to hear that the tutorials are easy to follow 😃
@erickgutierrez6471
@erickgutierrez6471 2 года назад
Dude , since i started watch your videos , my desire to learn python has grown.Thanks!
@CodingIsFun
@CodingIsFun 2 года назад
That's awesome to hear! Thank you for taking the time to leave a comment and for watching the videos! 😃
@florianroeseler2404
@florianroeseler2404 3 года назад
Didn’t know I needed this until now!
@CodingIsFun
@CodingIsFun 3 года назад
Thank you for watching the video, Florian. Glad you like it! 😃
@falcon2806
@falcon2806 3 года назад
Again a very good tutorial ... thanks Sven
@CodingIsFun
@CodingIsFun 3 года назад
Thank you for your support, Falcon. Glad you like it 😃
@risshirajsen8347
@risshirajsen8347 2 года назад
Thank you so much , i could easily follow along the tutorial and help automate a tidious task my father has to do eveytime.
@CodingIsFun
@CodingIsFun 2 года назад
That is awesome! Fantastic to hear that :)
@rty3997
@rty3997 Год назад
Thank you very much Sir! Your tutorial are very helpful and matched well with my work environment. Subscribed.
@CodingIsFun
@CodingIsFun Год назад
Thanks for the sub and welcome aboard! :)
@rodrigoarturoborjacalderon5913
@rodrigoarturoborjacalderon5913 2 года назад
AMAZING! keep doing your best :D
@CodingIsFun
@CodingIsFun 2 года назад
Thanks! Glad you like the solution :)
@victorsartor
@victorsartor Год назад
Your video solved half of my problems! Now I need to think of a way to convert the data from the excel file to a word file whenever a new entry is added to the excel file. I thought about using python-docx, but I would need to make the template ready for all possible entries in my csv file. Gosh I have no idea how to proceed lol Thanks for your work!!!!
@CodingIsFun
@CodingIsFun Год назад
Thanks for watching the video and good luck with your project! Happy Coding! 🤓
@KhalilYasser
@KhalilYasser 3 года назад
Awesome. Thank you very much.
@CodingIsFun
@CodingIsFun 3 года назад
As always, thank you very much for your comment & support 😃
@shrushtiamulya5553
@shrushtiamulya5553 2 года назад
Very Informative Thanks
@CodingIsFun
@CodingIsFun 2 года назад
Glad it was helpful! Thanks for watching :)
@cryptomugen1315
@cryptomugen1315 3 года назад
Wow, exactly what I was looking for. It's straight to the point and easy to understand. Can you show how we would have a dynamic sentence based on the number we import from Excel? e.g. Sales on {{this period}} was {{sales}} which is {{more/less}} than {{prev period}} for {{an increase/a decrease}} of {{sales/prev sales-1}}%.
@CodingIsFun
@CodingIsFun 3 года назад
Thanks for watching the video. Glad it was helpful. There are 2 approaches: a) You could simply concatenate your string directly in Excel and export it as only *one* variable, e.g. ="Sales on "&A1&" was "&A2&" which is "&IF(A2>B2,"more", "less")& " than….." b) Use the Jinja2 Tags in your Word documents: docxtpl.readthedocs.io/en/latest/#split-and-merge-text Hope it helps 😃
@pilotgundul
@pilotgundul 8 месяцев назад
Wow.. this is amazing.. Thanks for the tutorial
@CodingIsFun
@CodingIsFun 8 месяцев назад
Glad to hear you liked it! Thank you for commenting and watching.
@pilotgundul
@pilotgundul 8 месяцев назад
@@CodingIsFun I have no idea on python before but I think it is easy to learn ;) may be
@darshan511
@darshan511 Год назад
@coding is fun thank you for the wonderful tutorial it was so helpful to me..
@CodingIsFun
@CodingIsFun Год назад
Happy to hear that it was helpful; thank you for taking the time to leave a comment and for watching the video! 👍
@ElinLiu0823
@ElinLiu0823 2 года назад
much thanks,this touraial gonna help me,like!🥰
@CodingIsFun
@CodingIsFun 2 года назад
Thanks for watching the video. Glad to hear it was helpful! :)
@walidmat8972
@walidmat8972 Год назад
amazing video 🔥
@CodingIsFun
@CodingIsFun Год назад
Thank you!
@Paper4Wings
@Paper4Wings 2 года назад
Thanks a lot! Some trial and error as a new Python user, but got there in the end.
@CodingIsFun
@CodingIsFun 2 года назад
Glad you figured it out! :)
@Paper4Wings
@Paper4Wings 2 года назад
@@CodingIsFun Hey! It worked for a while but I'm now getting a "sh: python: command not found " error. Can you help?
@CodingIsFun
@CodingIsFun 2 года назад
@@Paper4Wings Sounds to me more like a Python (installation) issue. You might want to search the internet for a solution.
@Paper4Wings
@Paper4Wings 2 года назад
@@CodingIsFun turns out my Python was out of date, thanks!
@sheikhraisulislam4483
@sheikhraisulislam4483 2 года назад
well made tutorial sir
@CodingIsFun
@CodingIsFun 2 года назад
Happy to hear that it was useful; thank you for taking the time to leave a comment and for watching the video!
@cindyb9606
@cindyb9606 Год назад
Thank you again for your very helpful tutorial. I wanted tocomment that I was having difficulty getting the images to show up in MS Word. In case anyone else is also not getting the images to show up, I had to add the name of my placeholder value to the Alt Text parameter for that particular picture in the MS Word Template. Just go to the image placeholder picture in MS Word and right click on it to open the expanded menu, click on the option 'Edit Alt Text' and type in the image placeholder name (like Placeholder_A.png) - then exit the sidebar by clicking the 'X' Do NOT click on the button 'Generate alt text for me' -- it will do that with your tag when you close the menu.
@CodingIsFun
@CodingIsFun Год назад
Thanks for watching and your additional hint! 👍
@musicalharmony1402
@musicalharmony1402 Год назад
Hello, this is an amazing video . Very insightful and very useful. I was wondering if you could also give some ideas on how to create a PowerPoint using a similar dictionary rendering format? I have checked python-pptx but there we do not have the freedom to place the values in the placeholders. There we have fixed shapes and only they can be used.
@CodingIsFun
@CodingIsFun Год назад
Thank you for watching the video and for your question. Unfortunately, I do not know how to implement that right off the bat. I would also need to search the internet for a solution. Sorry that I cannot help!
@ajalikhanz
@ajalikhanz 2 года назад
Great video! If I wanted to implement this on someone else's laptop after I've done this on mine, would I have to do all this again? Or would I just have to send them all the files we have created here?
@CodingIsFun
@CodingIsFun 2 года назад
Thanks for watching the video. Assuming that the receiver also has Python, then you only need to send them the files.
@nipuniewijeweera8011
@nipuniewijeweera8011 Год назад
Great video! :) Also, I'm looking into based on a specific field/values from the Excel sheet, how to modify/set the values of radio buttons (to Yes/No) in the Word document?
@CodingIsFun
@CodingIsFun Год назад
Thank you for watching the video and for your question. Unfortunately, I do not know how to implement that right off the bat. I would also need to search the internet for a solution. Sorry that I cannot help!
@williammendieta5427
@williammendieta5427 3 года назад
Thanks! You can do this Word document automation using VBA too... its just not as easy as it is using Python!
@CodingIsFun
@CodingIsFun 3 года назад
Thank you for watching the video. True - with VBA, you could do the same. Yet I also like the fact that Python makes it very easy 👍
@coen690
@coen690 2 года назад
Thanks for the great tutorial. I am actually trying to create a very similar system. I have a question regarding the the line: import xlwings as xw and the line: from docxtpl import DocxTemplate. I get the errors Import "xlwings" could not be resolved and Import "docxtpl" could not be resolved. I checked and both libraries are installed. Do you have an idea what might be going wrong in this case? I used exactly the same code as in your video. I am using a mac though.
@CodingIsFun
@CodingIsFun 2 года назад
Thanks for watching. Both libraries will also work on mac. That said, it is hard to tell what might be causing the error from a distance. My best guess is that you are executing the code from a different environment (in which you do not have the libraries installed).
@rodfreitas1935
@rodfreitas1935 Год назад
Hi, Sven Excellent video! Congratulations Quick Question: Is there any possibility to update the table of contents using python docx?
@CodingIsFun
@CodingIsFun Год назад
Thank you for watching the video and for your question. Unfortunately, I do not know how to implement that right off the bat. I would also need to search the internet for a solution. Sorry that I cannot help!
@kirankrisnan
@kirankrisnan Год назад
Awesome video. I'm a big fan of your videos :) I was wondering is there any way to edit the values of an existing graph chart in ms word using docxtpl or docx or any other module? Not inserting an image as graph, but to edit/update the values of an existing graph in ms word using python. It will be great if you can come up with a solution. I'm sure it will be useful for many.!
@CodingIsFun
@CodingIsFun Год назад
Thank you for watching the video and for your question. Unfortunately, I do not know how to implement that right off the bat. I would also need to search the internet for a solution. Sorry that I cannot help!
@phunguyenhoang211
@phunguyenhoang211 2 года назад
Very useful to me. Thank you so much. Do you have any video/idea about automating copy/paste data from word to excel?
@CodingIsFun
@CodingIsFun 2 года назад
Thank you for watching the video & your questions. You might want to check out the following article: theautomatic.net/2019/10/14/how-to-read-word-documents-with-python/ There are different libraries to interact with Word. Once you get the values from the Word Document, you could use xlwings to insert them in Excel. I hope this helps!
@phunguyenhoang211
@phunguyenhoang211 2 года назад
@@CodingIsFun thank you
@HabibKhan-kj8um
@HabibKhan-kj8um 2 года назад
Thanks for the video. Quick question though, what if you have a dataframe and you want to generate multiple docs (same format)? Can we loop through the function you created and in each loop take one rows and create one doc?
@CodingIsFun
@CodingIsFun 2 года назад
Have a look at the following video: ru-vid.com/video/%D0%B2%D0%B8%D0%B4%D0%B5%D0%BE-Zy9sx4GvjUY.html I hope it helps! Happy Automating! :)
@HabibKhan-kj8um
@HabibKhan-kj8um 2 года назад
@@CodingIsFun That's awesome. Thank you very much
@rishanchaube3098
@rishanchaube3098 Год назад
Absolutely loved your video!!! Just one thing I need to know. When declaring the context dictionary, is there some way I can store the numbers in the same type as given in excel? Example: 1) if I use numbers=int while declaring the context dictionary, I can't work with specific values needing decimal precision (For example, mass of an electron). So how can I make python insert the exact same number as in excel?
@CodingIsFun
@CodingIsFun Год назад
Thank you for watching! If you'd like to obtain the original value without modifying it, you can simply remove the "numbers" parameter from the options method. Refer to the xlwings dictionary converter documentation for more information on available options: docs.xlwings.org/en/latest/converters.html#dictionary-converter
@fatoumatasissako2140
@fatoumatasissako2140 2 года назад
Hello, thank you very much for your very useful video. I would like to reproduce the same thing but instead of generating all the pdfs at the same time I want the word file to be created on demand. For example, I want to have a drop-down list that will allow me to select a client and then the code will generate its word file with its information. The drop-down list can be on Excel or on another interface. Do you have any ideas on how to do this please?
@CodingIsFun
@CodingIsFun 2 года назад
Thanks for watching the video. In the video, I am actually creating only one file. In your case, you just might want to insert a DropDown list in Excel (www.excel-easy.com/examples/drop-down-list.html). Based on the selected values from the DropDown, you can then change the variables using Excel formulas, e.g. =IF(A1="Client A", "If true show this value", "…otherwise show this value") I hope this helps!
@thefamousdjx
@thefamousdjx 3 года назад
Nice video. Would have been more useful if you had shown how to fill the table dynamically too. Most other cases one wont know beforehand the number of rows that will be required.
@CodingIsFun
@CodingIsFun 3 года назад
Thank for watching the video! Excellent hint! This is actually also possible within the docxtpl, but I did not show it in the video 🙁
@thefamousdjx
@thefamousdjx 3 года назад
Okay thanks, looking forward to more advanced video if you do make.
@jaggyjut
@jaggyjut Год назад
Nice. What if we have checkboxes and option buttons in the word template. I have a table in the word doc with yes/no and want to hide/show the value as per the value in the Excel column
@CodingIsFun
@CodingIsFun Год назад
Thank you for watching the video and for your question. Unfortunately, I do not know how to implement that right off the bat. I would also need to search the internet for a solution. Sorry that I cannot help!
@byqsxgzh7327
@byqsxgzh7327 2 года назад
Very helpful tutorial, excatly what I needed, thanks a lot. But how can I format numbers with comma separators and round to 2 decimal places?
@CodingIsFun
@CodingIsFun 2 года назад
Glad you liked the video. You can format numbers with Python. See the example below: my_number = 12345678.1234 my_number = f'{round(my_number,2):,}' print(my_number) Run the code online here: onecompiler.com/python/3xea6y593 I hope this helps!
@byqsxgzh7327
@byqsxgzh7327 2 года назад
@@CodingIsFun Thanks for your reply. I'm a beginner of coding. How can I use this function in this particulaur tutorial? As the info. used to render Word is from "context", and context is dict, I can't use f"{}" to format dict.
@josea.bocanegra6774
@josea.bocanegra6774 2 месяца назад
Muchas gracias , espectacular , muy agradecido, deseaaba consulta que contiene la macro Samplecall
@CodingIsFun
@CodingIsFun 2 месяца назад
Thanks for watching! Cheers, Sven 🙏
@reneoviedo3789
@reneoviedo3789 2 года назад
Thanks so much for the video!!, i was wondering if it is possible to convert all of this files into an .exe so i can run it in different computers that are not using python?
@CodingIsFun
@CodingIsFun 2 года назад
Thank you for watching the video. Yes, that is possible. Have a look at the following video: ru-vid.com/video/%D0%B2%D0%B8%D0%B4%D0%B5%D0%BE-Y0HN9tdLuJo.html I hope this helps! 👍
@JITISH1
@JITISH1 Год назад
Hi, extremely helpful tutorial. How does one go about doing this if the table has multiple columns? Eg Parameter | Start | Average | Failure| Where Start, Average, and failure have values, and the parameter is the actual "product name" in this case. The table in my word document is structured in the same way. Also, there are multiple tables on my first sheet. Thank you for your assistance with this tutorial. When working in the xlwings Excel file, the excel file closes as soon as I click the button.
@CodingIsFun
@CodingIsFun Год назад
Thank you very much for watching the video and your comment. Your requirements are well noted. Yet, I receive many requests for creating individual solutions. As much as I want to help, I simply do not find the time in my daily schedule to develop & test all the different requests. I hope you can understand. Thank you!
@zouhairsouam6709
@zouhairsouam6709 Год назад
This is very helpful, i would like to thank you. Please could you make another video on how to make a python script that draw a netwrok architecture or a network diagram and generate a visio file ? thank you.
@CodingIsFun
@CodingIsFun Год назад
Thank you for watching the video & your suggestion.
@wadspo7155
@wadspo7155 Год назад
Very interesting... I am trying to figure out how to automate a word document/pdf upon email receipt, as well as have that newly created word document/pdf emailed after creation.
@CodingIsFun
@CodingIsFun Год назад
Thanks so much for watching the video and leaving a comment! Your request is definitely noted. However, I get a ton of requests for custom solutions and, as much as I'd love to help everyone out, I just don't have the time in my schedule to develop and test all of them. I hope you can understand. Happy Coding!
@kilme880
@kilme880 2 года назад
that's helped me a lot ! where i can find good templates for analysis report ?
@CodingIsFun
@CodingIsFun 2 года назад
Thank you for watching the video & your question. I am not sure if those kind of templates exists - sorry 😕 I usually create my own templates as shown in the video.
@verma7723
@verma7723 2 года назад
Thanks a lot for this video.. learn a lot from this. Further, how can we make the number of rows in word file dynamic. For example - if the data in excel file is in 3 rows, word file also should show only 3 rows, and if it is 10 rows in excel, number of rows in word file may get expanded to 10. Any guidance/video/code could be very very useful. Thanks once again.
@CodingIsFun
@CodingIsFun 2 года назад
Thank you for watching the video & your question. You can also create dynamic tables. Kindly have a look at the following screenshot: www.screencast.com/t/piwEhsqfwq I have used the code straight from the docx-template GitHub page, which you can find here: github.com/elapouya/python-docx-template/blob/master/tests/dynamic_table.py For your convenience, I have copied the Word Template Files & Python code as shown in the screenshot to my Google Drive for you to download: drive.google.com/file/d/1WUZPXZSmpv3mcIOXOfyjmhymyNOr1ful/view?usp=sharing I hope this helps!
@verma7723
@verma7723 2 года назад
@@CodingIsFun thank you so much for being so kind and taking out time for this help. 😊😊
@walterruelas6064
@walterruelas6064 Год назад
Thanks so much Sven for the amazing video, please could you make a video to automate pptx documents, I think theres is a library pptxtpl. Thanks so much for your effort.
@CodingIsFun
@CodingIsFun Год назад
Thank you for watching the video & your suggestion.
@walterruelas6064
@walterruelas6064 Год назад
Hi again Sven, how can we get or create more placeholders images? cause we only have five in the folder you shared with us.
@CodingIsFun
@CodingIsFun Год назад
You can insert as many images as you want as showed in the video.
@bojandanon2037
@bojandanon2037 Год назад
I have big table with same data that I would like to put into template, is it possible to select certain range of cells in big table and than press button to put selected data into template ?
@CodingIsFun
@CodingIsFun Год назад
Thank you very much for watching the video and your comment. Your requirements are well noted. Yet, I receive many requests for creating individual solutions. As much as I want to help, I simply do not find the time in my daily schedule to develop & test all the different requests. I hope you can understand. Thank you!
@elpp2937
@elpp2937 2 года назад
Is it possible to combine and compare more than ten documents and then merge them into one with amendments being marked in revision mode? Thank you.
@CodingIsFun
@CodingIsFun 2 года назад
Questions are great, but I would also need to search the internet for an answer. I would suggest starting by comparing only 2 files using the win32com library: stackoverflow.com/questions/47212459/automating-comparison-of-word-documents-using-python Once that is working, you can try to merge multiple files. Sorry that I cannot help you further here. Happy Coding!
@dbiviss
@dbiviss 2 года назад
Do you know how can you work with tables dynamically ? Just without knowing the size of rows in the template and only in the excel file. Thank you!
@CodingIsFun
@CodingIsFun 2 года назад
Here is an example: github.com/elapouya/python-docx-template/blob/master/tests/dynamic_table.py The script is referring to this Word document: github.com/elapouya/python-docx-template/blob/master/tests/templates/dynamic_table_tpl.docx Screenshot: www.screencast.com/t/SyN9abVBr8E
@sbalachandran150
@sbalachandran150 2 года назад
Hi! Many thanks for this wonderful tutorial. Appreciate it. I was able to follow your instructions and design one. It worked. But I have one minor issue. I have a date cell in Excel. I want to populate word with string date for example 1 January, 2022 instead of 1/1/2022. Is there a way out? Thanks once again and have a nice day!😊
@CodingIsFun
@CodingIsFun 2 года назад
Thank you very much for watching the video and your comment. Your requirements are well noted. Yet, I receive many requests for creating individual solutions. As much as I want to help, I simply do not find the time in my daily schedule to develop & test all the different requests. I hope you can understand. Thank you
@rty3997
@rty3997 Год назад
How about converting the date value into text first in excel with "=TEXT([YourDateCell],"d mmm yyyy")" ?
@sbalachandran150
@sbalachandran150 Год назад
@@rty3997 Hi!Many thanks for your solution. It worked great.You are a saviour! Thanks again.👍
@privateusername2222
@privateusername2222 10 месяцев назад
I need to use word's field programming to modify the text of the word document based on excel values. Any suggestion how to do this with your excel method? Ive used text input boxes in my word doc and no excel all along. Thank you.
@CodingIsFun
@CodingIsFun 9 месяцев назад
Thanks so much for watching the video and leaving a comment! Your request is definitely noted. However, I get a ton of requests for custom solutions and, as much as I'd love to help everyone out, I just don't have the time in my schedule to develop and test all of them. I hope you can understand. Happy Coding!
@rajasingam.d
@rajasingam.d 3 года назад
This work very nicely. But if we have input data in C column. i mean need multiple doc for the data. How this can be achieved. Do you have any reference. Using for i need to automate more than 2 records. Can you please help me on this. Input data is in B column, i have B and C column input data. How do we can bring the data in context. Thanks
@CodingIsFun
@CodingIsFun Год назад
Thank you very much for watching the video and your comment. Your requirements are well noted. Yet, I receive many requests for creating individual solutions. As much as I want to help, I simply do not find the time in my daily schedule to develop & test all the different requests. I hope you can understand. Thank you!
@alexandregoncalves5478
@alexandregoncalves5478 3 года назад
This is amazing!!! Can you provide a example template tags {{ }} only using excel?
@CodingIsFun
@CodingIsFun 3 года назад
Thank you for watching the video. Do you mean converting an Excel Workbook to Word? Like, writing the text in an Excel cell and by clicking a button, it should create a Word Document?
@py_tok5589
@py_tok5589 3 года назад
@@CodingIsFun yes please
@CodingIsFun
@CodingIsFun 3 года назад
@@py_tok5589 One easy way would be the use of VBA. I found a great blog article about this: www.exceltip.com/applications-word-outlook-in-vba/copy-worksheet-information-to-word-using-vba-in-microsoft-excel.html I went ahead and tested the solution - it works like a charm. In the blog article, you will also find a download link to the example workbook. Hope this solution is working for you.
@skjchan
@skjchan Год назад
Thank you so much for your tutorial. I followed your tutorial and created my first word document with data from excel successfully. Now I have a list of student name, class and class number to be displayed under the same word documents, say a table of 15 rows x 3 columns, how can I add it to the word template so that python can extract data from the excel table?
@CodingIsFun
@CodingIsFun Год назад
Thanks for watching. You can extract the Excel table using xlwings: stackoverflow.com/a/36396797 Once you have the data from Excel, you can create a dynamic Word table: Here is an example: github.com/elapouya/python-docx-template/blob/master/tests/dynamic_table.py The script is referring to this Word document: github.com/elapouya/python-docx-template/blob/master/tests/templates/dynamic_table_tpl.docx Screenshot: www.screencast.com/t/SyN9abVBr8E I hope it helps! Happy Coding!
@walterruelas6064
@walterruelas6064 Год назад
Excellent video, please how can I change the decimal separator from points to commas, I need to work with one decimal value separated the decimal part with a comma. Thanks so much.
@CodingIsFun
@CodingIsFun Год назад
Thanks for watching. What have you tried so far?
@walterruelas6064
@walterruelas6064 Год назад
@@CodingIsFun I tried to put instead of int str, but doesn't work.
@walterruelas6064
@walterruelas6064 Год назад
The solution I found, eventhough I think it is not optimal is to apply functions in excel to round and convert to text the numbers according to my desired format.
@CodingIsFun
@CodingIsFun Год назад
@@walterruelas6064 xlwngs will just ensure to read in the datatype correctly (int or float) docs.xlwings.org/en/stable/converters.html. To format your numbers, have a look at the following blog post: pythonguides.com/python-format-number-with-commas/#:~:text=In%20Python%2C%20to%20format%20a,thousand%20places%20starting%20from%20left.&text=After%20writing%20the%20above%20code,appear%20as%20a%20%E2%80%9C%205%2C000%2C000%E2%80%9D. I hope it helps! Happy Coding!
@arcticwildernesssurvival680
@arcticwildernesssurvival680 2 года назад
Hi, excellent tutorial! I ran into an issue when assigning the sample call macro to the button - Excel runs into an error, that it can't find Python and to download it from the Microsoft store. The excel template comes with some settings options, but I was unable to resolve the issue. Do you have any recommendations? Thanks.
@CodingIsFun
@CodingIsFun 2 года назад
Thanks for watching the video. It sounds to me that you might have trouble with xlwings. For the sake of troubleshooting, could you kindly check out the following tutorial: ru-vid.com/video/%D0%B2%D0%B8%D0%B4%D0%B5%D0%BE-iIATJtruZBE.html In the video, I am going into more depth on how to set up/use xlwings. Once xlwings is running, you should also be able to automate word, as shown in this video. I hope it helps.
@arcticwildernesssurvival680
@arcticwildernesssurvival680 2 года назад
@@CodingIsFun Thank you. I resolved the issue by installing the xlwings add-in. Thanks again for your help!
@arcticwildernesssurvival680
@arcticwildernesssurvival680 2 года назад
@@CodingIsFun Hi, another quick question: is it possible to pull data from multiple excel sheets (one spreadsheet, multiple tabs) at once? Eg. if I have context on two excel sheets that I want render in the same word document. I tried: sht_panel = wb.sheets["PANEL"] sht_other_data = wb.sheets["OTHER_DATA"] context = sht_panel.range('A2').options(dict, expand='table', numbers=int).value context2 = sht_other_data('A2').options(dict, expand='table', numbers=int).value and then doc.render(context) doc.render(context2) doc.save(output_name) BUT it will only render one of those, not both. So I assume I need to define the multiple sheets in just one context variable, but what would this look like? Thanks for your help!
@CodingIsFun
@CodingIsFun 2 года назад
@@arcticwildernesssurvival680 I assume there might be a typo: context2 = sht_other_data('A2').options(dict, expand='table', numbers=int).value The 'range' is missing. If that does not resolve it, you could try to merge the two dicts into one and then render the context: final_context = {**context, **context2}
@arcticwildernesssurvival680
@arcticwildernesssurvival680 2 года назад
@@CodingIsFun I actually had the 'range' but dropped it from the youtube comment for some reason.. merging the dictionaries worked great. Thank you for the help! Liked and subscribed!
@hellohello-gx1fp
@hellohello-gx1fp Год назад
Thank you, that's really helpful! I would like to ask If it is possible to convert this python file to exe? I have tried many times by pyinstaller but failed ,it said that no module named [that filename]. Do you know why is that? thx
@CodingIsFun
@CodingIsFun Год назад
Thanks for watching and for your question. Hard to tell from a distance why you are facing an error. Sorry that I cannot help.
@elbadrey
@elbadrey 11 месяцев назад
good tut, try to tell us. How did we find and replace text?
@CodingIsFun
@CodingIsFun 10 месяцев назад
Thanks for watching. Here you are: ru-vid.com/video/%D0%B2%D0%B8%D0%B4%D0%B5%D0%BE-cUUjkEgnCjs.html
@lionelnkaya2359
@lionelnkaya2359 2 года назад
Thank you so much for this awesome content. The first part works for me, I am able to render the file based on the template. But when I try to do it using the button on Excel I get this error --------------------------- Package not found at 'MainTemplate.docx' I really do not understand as anyone ran into a similar issue? Thank you for the tutorial!
@lionelnkaya2359
@lionelnkaya2359 2 года назад
It actually works! but because my script is stored on Microsoft OneDrive, for changing the path to current directory I had to use a variable path = r 'pathOnMyComputer' instead of os.chdir(sys.path[0]). Thank you so much @Coding Is Fun for making writing useful Python so pleasant! You have won a new subscriber :)
@benarnold5738
@benarnold5738 2 года назад
I have had the same issue, have you found a fix?
@CodingIsFun
@CodingIsFun Год назад
I have updated the code to fix this: github.com/Sven-Bo/python-word-automation/commit/39856047afee726ce34dae521f8ad173774eaba9 Please clone the repo and give it another try: github.com/Sven-Bo/python-word-automation
@Hex-Scholar
@Hex-Scholar Год назад
Hey, how could we add the rendered word file created using docxtpl into an existing word file.
@CodingIsFun
@CodingIsFun Год назад
Thank you very much for watching the video and your comment. Your requirements are well noted. Yet, I receive many requests for creating individual solutions. As much as I want to help, I simply do not find the time in my daily schedule to develop & test all the different requests. I hope you can understand. Thank you!
@Jett-Molly
@Jett-Molly Год назад
Great video, just what I was looking for. I have hit a problem though line 19 & 20. when I type in context it comes up as an error. As the video is 2 years old, has this been updated?
@CodingIsFun
@CodingIsFun Год назад
Thanks for watching. The error message would be helpful. You can find the latest code in the GitHub repo (see description)
@Jett-Molly
@Jett-Molly Год назад
@@CodingIsFun thanks for your reply. there is no error code as such, it underlines the word 'content' like it doesn't recognise it and has a 1 next to the file name at the top left of the file. I have only just started learning Python but being able to use it to create reports in word/PDF like you have from Excel data is what I have been looking for and would be really helpful. I will try and find the code in your links
@Jett-Molly
@Jett-Molly Год назад
@@CodingIsFun I pasted the latest code in and it still doesn't like the word content in the section where you are creating a new file name. it is saying it is an error. I can not attach a screenshot here is there an email I can send it to.?
@jhanvivadher257
@jhanvivadher257 3 месяца назад
Hi, The document is created when I run the Python file. However it doesn't CREATE document when I click the button. I include printing something like 'Bye Xkwings'. So it works. But the document is not created. Please help
@CodingIsFun
@CodingIsFun 2 месяца назад
Thanks for watching and for your question. Hard to tell from a distance why you are facing an error. Sorry that I cannot help. Cheers, Sven ✌️
@SaulEduardoo2
@SaulEduardoo2 2 года назад
I have issues to execute this instruction at the CMD window "xlwings quickstart word-automation --standalone" it tells me that the command "xlwings" is not recognizable as an external command internal and/or external
@CodingIsFun
@CodingIsFun 2 года назад
Did you install it using 'pip install xlwings'?
@SaulEduardoo2
@SaulEduardoo2 2 года назад
@@CodingIsFun Yes Sven
@CodingIsFun
@CodingIsFun 2 года назад
@@SaulEduardoo2 are you sure that you are calling 'xlwings' from the same environment you installed it in? Please check it with 'pip freeze' in the same command prompt that shows the error
@feliciak3483
@feliciak3483 Год назад
@@CodingIsFun I'm having the same problem. I've checked it with pip freeze. It's just the addin that wont install. Did anyone having this problem figure out a solution?
@Diwakarc007
@Diwakarc007 Год назад
@codingisfun, Sven - Did we find a solution to this issue?
@enginalkan8493
@enginalkan8493 6 месяцев назад
hello. thanks for the great video. I downloaded all docs, template and code. I am able to execute python script that successfully generate updated document. However, I am having trouble with executing buttons on excel sheets. When I test button on PANEL sheet, I am getting an error "python was not found". I am wondering if you can comment on how to connect the python script into the excel workbook. thanks in advance,
@CodingIsFun
@CodingIsFun 6 месяцев назад
Thanks for watching and for your question. Hard to tell from a distance why you are facing an error. Sorry that I cannot help.
@jesusrodriguez-ls8nr
@jesusrodriguez-ls8nr 7 месяцев назад
Awesome video! I tried implementing it but for some reason i can only run it from python directly, if it try to run the code through excel macro it always fails on the doc.render(context) line. Can anyone help or point me to where get help for that?
@CodingIsFun
@CodingIsFun 7 месяцев назад
Thanks for watching. Please clone the GitHub repo and try again.
@tim942926019
@tim942926019 Год назад
Hello Sven! I thank you for all your doing for us. I'd like to know how to use a word97-2003(*.doc) file in python
@CodingIsFun
@CodingIsFun Год назад
Thank you for watching the video and for your question. Unfortunately, I do not know how to implement that right off the bat. I would also need to search the internet for a solution. Sorry that I cannot help!
@tim942926019
@tim942926019 Год назад
@@CodingIsFun 🙏
@rosha3933
@rosha3933 2 года назад
Can someone help me, after I install "xlwings" and type " xlwings quickstar " it doesn"t work, it says it is not recognized as an intern or external command.
@CodingIsFun
@CodingIsFun 2 года назад
Did you install it using 'pip install xlwings'?
@SaulEduardoo2
@SaulEduardoo2 2 года назад
The same happened to me... I'm using the CMD window and tells me that after used the command "pip install xlwings"
@eriktedja1199
@eriktedja1199 2 года назад
Is It possible to get the data from Multiple Columns and Multiple Rows ? for example Col A : Company Name, Col B : Cities, Col C : Revenue and so on. The Word Document will have 3 paragraph, Each Paragrah will talk about a different company from the above table. After testing this, I've met some problems: Traceback (most recent call last): File "C:\Users\x\Desktop\word_automation\example.py", line 9, in placeholder_1 = InlineImage(doc, 'Placeholders/Placeholder_1.png', Cm(5)) NameError: name 'InlineImage' is not defined
@CodingIsFun
@CodingIsFun 2 года назад
Yes, it is possible, but it requires further modification to the code. I hope you understand that I cannot code out a complete example for you. Regarding your error message, ensure that you have InlineImage imported: from docxtpl import DocxTemplate, InlineImage # pip install docxtpl Happy Coding! :)
@mladenvujic4034
@mladenvujic4034 2 года назад
Instead of integer format, how can I retrieve "source formatting" (###.#, ###>#%, etc.) from the file? in this line of code: context = sht_panel.range("A2").options(dict,expand="table", numbers=int).value Tnx!
@CodingIsFun
@CodingIsFun 2 года назад
Thanks for watching. xlwngs will just ensure to read in the datatype correctly (int or float) docs.xlwings.org/en/stable/converters.html. To format your numbers, have a look at the following blog post: queirozf.com/entries/python-number-formatting-examples I hope it helps! Happy Coding!
@mladenvujic4034
@mladenvujic4034 2 года назад
@@CodingIsFun Thank you, really helpful for formatting! Additional questions:) what would be the easiest way to insert an excel table in Word in the same format? thanks!
@user-bt5gt1fy3t
@user-bt5gt1fy3t 10 месяцев назад
hello, in one of my application if user order more then one product we have to create same structure of table for each product dynamically and stable structure, style provide user only , we just know filed/label are fix. so any one can guide how we can achieve.
@CodingIsFun
@CodingIsFun 10 месяцев назад
Thanks so much for watching the video and leaving a comment! Your request is definitely noted. However, I get a ton of requests for custom solutions and, as much as I'd love to help everyone out, I just don't have the time in my schedule to develop and test all of them. I hope you can understand. Happy Coding!
@PerFeldvoss
@PerFeldvoss 2 года назад
... can you generate a word table with data from excel, looks like you will need to use a template with the same names again and again. But how can you do that?
@CodingIsFun
@CodingIsFun 2 года назад
Yes, that is possible. Here is an example: github.com/elapouya/python-docx-template/blob/master/tests/dynamic_table.py The script is referring to this Word document: github.com/elapouya/python-docx-template/blob/master/tests/templates/dynamic_table_tpl.docx Screenshot: www.screencast.com/t/SyN9abVBr8E
@mushtaqtaher
@mushtaqtaher 2 года назад
Hey - When I try to install Docxtpl or python-docx it always says pip command not found on my command prompt - do you know why this is this? Thanks
@CodingIsFun
@CodingIsFun 2 года назад
Try: pip3 install python-docx If that does not help, have a look at the following blog article: techlib.fr/app/19847/how-do-i-fix-pip-command-not-found
@jeandahlquist
@jeandahlquist 2 года назад
Stupid question most likely, and I did restart the kernel but I get a syntax error from simply writing xlwings quickstart work_automation --standalone. xlwings is fully installed.
@CodingIsFun
@CodingIsFun 2 года назад
Could you paste the error message/tracelog here?
@israrhussainrao8022
@israrhussainrao8022 2 года назад
how can we add border to the paragraph?
@CodingIsFun
@CodingIsFun 2 года назад
Thanks for watching the video. The idea of this project is to do all the styling of your Word template beforehand, like adding borders, position elements, etc. With Python, I am 'just' injecting the values from Excel into the Word document (rather than formatting the Word document using Python).
@fernandojavierleon5442
@fernandojavierleon5442 2 года назад
Hello, how can I put images from a url? I've tried but can't.
@CodingIsFun
@CodingIsFun 2 года назад
Try out the following solution: stackoverflow.com/a/24348524
@senahugtfl7789
@senahugtfl7789 Год назад
hi ı have a issue when ı was writing my file path .According to the internet i ve written correct but for ATOM accepted if I only write full absolute path starting ffrom "C:".And it is so unfit could you hepl me ?
@CodingIsFun
@CodingIsFun Год назад
Thanks for watching. Unfortunately, with that bit of information, I cannot help you. You might want to take some time to write down the exact error message. It would also be great to let me know if you have made any modifications to the initial code I have shared on GitHub. Thanks!
@senahugtfl7789
@senahugtfl7789 Год назад
@@CodingIsFun when ı write lie this: with open(".\Input\Names ame.txt") as file: It gives me the errror like this: No such file or directory: '.\\Input\\Names\ ame.txt' the problem is i check the folder and files.They are in there.But my laptop cant find until i havent written the long version like this: C:\***\***\***\***\***\Input\Names ame.txt ı do not know how can ı fix this problem because that one is so long and unfit .
@CodingIsFun
@CodingIsFun Год назад
@@senahugtfl7789 I suggest using Pathlib when dealing with file paths. Here is a quick start guide: ru-vid.com/video/%D0%B2%D0%B8%D0%B4%D0%B5%D0%BE-iqZ2V8qTYq8.html
@sumeetkavathekar3694
@sumeetkavathekar3694 Год назад
Hi there I am encountering this particular error "Exception has occurred: com_error (-2147221005, 'Invalid class string', None, None) " any suggestion to remove the error?
@CodingIsFun
@CodingIsFun Год назад
Thanks for watching. Unfortunately, with that bit of information, I cannot help you. You might want to take some time to write down which line of code is causing the error; let me know if you have modified the code from the tutorial, explain in more depth what you did to troubleshoot the problem and provide some more context. Thanks!
@harishrajkumar5607
@harishrajkumar5607 Год назад
im having trobule with creating folder in desktop im getting error like xlwings is not regonized please guide me withhow to slove this error
@CodingIsFun
@CodingIsFun Год назад
Thanks for watching the watching and your question. It is hard to tell from a distance what is causing the error. Try searching for the text of your error message on google/StackOverflow.
@divz2646
@divz2646 Год назад
Can you upload and suggests such vidoes for a researcher?
@CodingIsFun
@CodingIsFun Год назад
Thanks for watching. What exactly do you mean? Please provide some additional information
@divz2646
@divz2646 Год назад
@@CodingIsFun like as a PhD scholar we have to manage data..make pie charts, barcharts,digrams, perform statistical tests...can you suggest some help in this scientific field of ours
@divz2646
@divz2646 Год назад
Also can you guide how to use bioinformatics tools using coding
@matthewtaylor6284
@matthewtaylor6284 Год назад
For anyone having problems getting your samplecall macro to run, you might need to run the following command in your terminal "xlwings addin install"
@CodingIsFun
@CodingIsFun Год назад
Thank you for watching and sharing your suggestion! In this situation, the xlwings add-in might not be necessary. Just running the command "xlwings quickstart word_automation --standalone" should be enough. However, I'm glad to hear that installing the additional xlwings add-in was helpful for you.
@sayo6305
@sayo6305 Месяц назад
I am getting 'ModuleNotFoundError: No module named 'docxcompose'. I have installed it using pip but still the error persists
@CodingIsFun
@CodingIsFun Месяц назад
Thanks for watching. Have you tried to run "pip install docxcompose"? Cheers, Sven ✌️
@firstlady9627
@firstlady9627 7 месяцев назад
The text file doesnt change to python format. What went wrong on my side?
@CodingIsFun
@CodingIsFun 7 месяцев назад
Thanks for watching. Hard to tell from a distance
@anishatg2886
@anishatg2886 3 месяца назад
Hy when I click the update document button, I get a error message saying python was not found. Can you help me how to solve it please
@CodingIsFun
@CodingIsFun 3 месяца назад
Did you install Python?
@jsrevathy
@jsrevathy 2 года назад
I am not able to locate the samplecall macro in my excel. How to add it?
@CodingIsFun
@CodingIsFun 2 года назад
Thanks for watching. Have you followed the steps as explained at 1:56 min?
@jsrevathy
@jsrevathy 2 года назад
@@CodingIsFun I am using PyCharm. I installed xlwings package in my project. But it didn't reflect in my Excel. Should I install xlwings some where else? I tried installing it in cmd prompt too.
@CodingIsFun
@CodingIsFun 2 года назад
As shown in the video, please use 'xlwings quickstart projectname --standalone'
@viniciusoliveirablackman578
@viniciusoliveirablackman578 4 месяца назад
Hello, I install the libary but i get the erro "TypeError: 'module' object is not callable
@CodingIsFun
@CodingIsFun 4 месяца назад
Please clone the repor and try again. Thanks!
@manipalreddy1458
@manipalreddy1458 Год назад
--------------------------- Error --------------------------- Traceback (most recent call last): File "", line 1, in File "C:\Users\chitt\OneDrive\desktop\word_automation\word_automation.py", line 10, in os.chdir(sys.path[0]) OSError: [WinError 123] The filename, directory name, or volume label syntax is incorrect: '' Press Ctrl+C to copy this message to the clipboard. --------------------------- OK --------------------------- please help me with this while im pressing the update word document button it is showing like this
@CodingIsFun
@CodingIsFun Год назад
Thanks for watching. I have made the pathsettings more robust ( github.com/Sven-Bo/python-word-automation/commit/39856047afee726ce34dae521f8ad173774eaba9 ) Please use the latest version: github.com/Sven-Bo/python-word-automation/commits/master Happy Coding!
@cameronf406
@cameronf406 Год назад
@@CodingIsFun I think this comment should be stickied at the top. It can save people a LOT of time troubleshooting :)
@AnqiCheng
@AnqiCheng 2 месяца назад
I had error when trying to install python-docx: note: This error originates from a subprocess, and is likely not a problem with pip. ERROR: Failed building wheel for lxml Failed to build lxml ERROR: Could not build wheels for lxml, which is required to install pyproject.toml-based projects
@CodingIsFun
@CodingIsFun 2 месяца назад
You could try: pip install lxml
@masalex6764
@masalex6764 Год назад
06:00
@CodingIsFun
@CodingIsFun Год назад
?
@elsabiosapo4835
@elsabiosapo4835 Год назад
Amigo no hay tradición al español. Necesito de ley usar esta herramienta. Y no hay subtítulos en español....
@CodingIsFun
@CodingIsFun Год назад
Hey, sorry about the absence of Spanish subtitles.
@GustavoRios-kl2um
@GustavoRios-kl2um Год назад
Could anyone help me with this error? It happens on excel when I try to click the button to Update the Word Document --------------------------- Error --------------------------- Traceback (most recent call last): File "", line 1, in File "c:\users\optimale\desktop\automation\Automation.py", line 10, in os.chdir(sys.path[0]) OSError: [WinError 123] A sintaxe do nome do arquivo, do nome do diretório ou do rótulo do volume está incorreta: '' Press Ctrl+C to copy this message to the clipboard.
@CodingIsFun
@CodingIsFun Год назад
Thanks for watching. Please use the updated version from GitHub: github.com/Sven-Bo/python-word-automation
@upandabout3132
@upandabout3132 3 года назад
Could not import InLineImage...any help
@CodingIsFun
@CodingIsFun 3 года назад
Thanks for watching the video. What does the error message say?
@upandabout3132
@upandabout3132 3 года назад
importError: cannot import name ‘InLineImage’ from ‘docxtpl’
@albertovielledent1053
@albertovielledent1053 Год назад
I'm getting this error whenever I try to use the button in excel: Traceback (most recent call last): File "", line 1, in ModuleNotFoundError: No module named 'word_automation' Anyone with the same issue that might have a solution?
@CodingIsFun
@CodingIsFun Год назад
Thank you for watching! Please clone the Github repo and try again.
@ananguyen4509
@ananguyen4509 Год назад
@@CodingIsFun : Hi, I face the same problem. Could you please explain more. I try to clone the Github repo and try again but it doesn't work. Thank you.
@elsabiosapo4835
@elsabiosapo4835 Год назад
graciss brother ya esta en el español. yo deseo automatizar mi trabajo. debo digitar datos que van a una tabla excel todos los dias. y eso me quita tiempo.. y deseo pasarlo del archivo pdf mediante algun codigo que maneje el ocr que detecte las palabras que van a mi tabla excel de forma automatica... y eso me facilitaria enormemente el trabajo.... me daria tiempo para mas cuestiones operativas de las cuales soy responsable... agradezco tu atencion....
@CodingIsFun
@CodingIsFun Год назад
Thanks so much for watching the video and leaving a comment! Your request is definitely noted. However, I get a ton of requests for custom solutions and, as much as I'd love to help everyone out, I just don't have the time in my schedule to develop and test all of them. I hope you can understand. Happy Coding!
@gamingkulanthai9046
@gamingkulanthai9046 11 месяцев назад
xlwings quickstart projectname not working
@CodingIsFun
@CodingIsFun 11 месяцев назад
Thanks for watching. Nope, the xlwings quickstart command is still working 😅
@gamingkulanthai9046
@gamingkulanthai9046 11 месяцев назад
@@CodingIsFun not working for me it not creating new folder with python file and Excel file
@CodingIsFun
@CodingIsFun 11 месяцев назад
@@gamingkulanthai9046 That might be. But with that bit of information, I really cannot help you 😅
@gamingkulanthai9046
@gamingkulanthai9046 11 месяцев назад
@@CodingIsFun Is there any other way without using xlwings quickstart projectname command ? . I manually created project folder and created necessary python file and Excel file. I can able to fetch data from Excel sheet and update in word document. I just want to run python file with the help of button from Excel sheet. Can you please help me on this.?
@valarmorghulis9244
@valarmorghulis9244 11 месяцев назад
How to protect a Word File in python?
@CodingIsFun
@CodingIsFun 11 месяцев назад
Thanks so much for watching the video and leaving a comment! Your request is definitely noted. However, I get a ton of requests for custom solutions and, as much as I'd love to help everyone out, I just don't have the time in my schedule to develop and test all of them. I hope you can understand. Happy Coding!
@yossialmogmaman4121
@yossialmogmaman4121 2 года назад
--------------------------- Error --------------------------- Traceback (most recent call last): File "", line 1, in File "C:\Users\XXXXXXXXXXX\desktop\projects\exceltoword\word_automation\word_automation.py", line 7, in os.chdir(sys.path[0]) OSError: [WinError 123] The filename, directory name, or volume label syntax is incorrect: '' Press Ctrl+C to copy this message to the clipboard. What should I do now? Thanks in advance!
@navinpandey1534
@navinpandey1534 Год назад
Same error
@zarinadavletova1178
@zarinadavletova1178 Год назад
same error
@CodingIsFun
@CodingIsFun Год назад
Sorry for the late reply. I have adjusted the path settings to make the code more robust. Check out the changes here: github.com/Sven-Bo/python-word-automation/commit/39856047afee726ce34dae521f8ad173774eaba9 I suggest to clone the latest version here and give it another try: github.com/Sven-Bo/python-word-automation
@forbidenfox3453
@forbidenfox3453 3 года назад
How to make bulk doc file using this method? Pls answer 🙏
@CodingIsFun
@CodingIsFun 3 года назад
Thanks for watching the video. That is also possible. I am not entirely sure how your final desired output should look like. Hence, it is tough for me to provide you with any code snippet. Yet, you might just want to implement a for loop to create several Word Documents. Cheers, Sven
@forbidenfox3453
@forbidenfox3453 3 года назад
Thank you I've found it, your video is amazing, I'm just a little confused just modifying the code a little to suit my needs
@forbidenfox3453
@forbidenfox3453 3 года назад
Translated using google translate, because I'm Asian
@kapibara2440
@kapibara2440 10 месяцев назад
9
@CodingIsFun
@CodingIsFun 10 месяцев назад
@FelipeCosta-uc1tc
@FelipeCosta-uc1tc Год назад
Thanks a lot for this video. at fisrt, mine worked just fine. Then I implemented more placeholders and it doesnot work anymore. Tried again from the begining and it keeps giving me a the same error: " doc.render(context)" "jinja2.exceptions.TemplateSyntaxError: Invalid character in identifier"
@FelipeCosta-uc1tc
@FelipeCosta-uc1tc Год назад
Found it. The problem was my template with special characters, even if I was not going to use them, it seems the cod run all of them.
@CodingIsFun
@CodingIsFun Год назад
Happy to hear that you figured it out!
@isaiahbaker1334
@isaiahbaker1334 Год назад
--------------------------- Error --------------------------- Traceback (most recent call last): File "", line 1, in File "c:\users\consultoria3\desktop\word_automation\word_automation.py", line 5, in import matplotlib.pyplot as plt # pip install matplotlib ModuleNotFoundError: No module named 'matplotlib' Press Ctrl+C to copy this message to the clipboard. --------------------------- "I need somebody Help. Not just anybody..."
@isaiahbaker1334
@isaiahbaker1334 Год назад
--------------------------- Error --------------------------- Traceback (most recent call last): File "", line 1, in File "c:\users\consultoria3\desktop\word_automation\word_automation.py", line 10, in os.chdir(sys.path[0]) FileNotFoundError: [WinError 2] The system cannot find the file specified: 'c:\\users\\consultoria3\\desktop\\word_automation\\word_automation.zip' Press Ctrl+C to copy this message to the clipboard. --------------------------- OK ---------------------------
@CodingIsFun
@CodingIsFun Год назад
Thanks for watching. Use the updated code from GitHub and ensure to install the requirements (requirements.txt): github.com/Sven-Bo/python-word-automation
@isaiahbaker1334
@isaiahbaker1334 Год назад
@@CodingIsFun Thankyou so much. If I debug the code it works, but I keep getting this message everytime i hit the button. --------------------------- Error --------------------------- Traceback (most recent call last): File "", line 1, in ModuleNotFoundError: No module named 'word_automation' Press Ctrl+C to copy this message to the clipboard. --------------------------- OK ---------------------------
Далее
How to Replace VBA with Python(Step-By-Step Tutorial)
31:19
Automatically Fill Word Files with Python
14:35
Просмотров 17 тыс.
How Many Balloons Does It Take To Fly?
00:18
Просмотров 37 млн
Automate Excel using Python + ChatGPT-4o 🤯
7:40
Просмотров 20 тыс.
Word DOCX From Template | Python
19:54
Просмотров 40 тыс.
3 PYTHON AUTOMATION PROJECTS FOR BEGINNERS
17:00
Просмотров 1,5 млн
Automate Boring Office Tasks with ChatGPT and Python
10:06