docxtpl python library for creating automated reports from word templates

Поделиться
HTML-код
  • Опубликовано: 28 ноя 2024

Комментарии • 99

  • @daniilvolkov1705
    @daniilvolkov1705 11 месяцев назад +3

    I am new to python, and your video helped me to automate creation of 500+ docs with tables inside. I saw other videos, but your is the one I was looking for. I just copied the code and adjusted to my specifics, and everything worked like charm, no errors. Thank tou very much, sir, really appreciated!

  • @alagarsamy3079
    @alagarsamy3079 3 года назад +4

    Great Video, Nice Explanation.

  • @chinnfang9376
    @chinnfang9376 Год назад +2

    you saved me with this tutorial - THANK YOU! straightforward and gets the job done. 10000/10 🔥

    • @learningsoftwareskills
      @learningsoftwareskills  Год назад

      Thank a ton for the amazing feedback. I am very happy that this content is helping people 👍😊

  • @ammadkhan4687
    @ammadkhan4687 Год назад +1

    Sir you have really saved my day. Thank you for this tutorial.

  • @henriquedopradocezar9541
    @henriquedopradocezar9541 2 года назад +2

    Thank you. That was an excellent and simple video to follow. Congrats.

  • @afreenfatima9157
    @afreenfatima9157 2 года назад +2

    Wonderful explanation! thanks a lot for this masterpiece

  • @salehal-mair26
    @salehal-mair26 7 месяцев назад +1

    Thank you so much for the detailed explanation. it really helped me!

  • @arielaava2102
    @arielaava2102 2 года назад +2

    Great Video! very helpful

  • @RobbinHoodT
    @RobbinHoodT 2 года назад +3

    Thank you so much! You're very helpful for me to get how to work with tables :)

  • @walterrandazzo6399
    @walterrandazzo6399 2 года назад +3

    Hi dude, a great video . Thanks 4sharing. Lets say we have to print all the invitations of the first example in the same file but in different pages? Or even in the 2nd example we have to print differents reports in different pages in the same file. How to deal with that? Thanks in advance.

    • @learningsoftwareskills
      @learningsoftwareskills  2 года назад +2

      Hii, just just a for loop to print all the invitations or reports in the same file. You can also insert page break in the template word file to ensure that each report starts from a new page
      Hope this helps, Cheers 👍

  • @codewitherror2599
    @codewitherror2599 2 года назад +1

    Great Explanation

  • @polyniceoyono1280
    @polyniceoyono1280 2 года назад +2

    exactly what i needed!!! thanx

  • @user-do3nl9fq6n
    @user-do3nl9fq6n 2 года назад +1

    highly appreciated work

  • @sayo6305
    @sayo6305 6 месяцев назад

    Great video! Thanks so much. Please make a video on linking excel sheets into word using python.

    • @sayo6305
      @sayo6305 6 месяцев назад

      I am getting 'ModuleNotFoundError: No module named 'docxcompose'. I have installed it using pip but still the error persists

  • @numpyasnum1768
    @numpyasnum1768 2 года назад +1

    Awesome man, thanks, this helped me

  • @nict5683
    @nict5683 Год назад +1

    Hi i am getting the following error "the file is not displayed in the text editor because it is either binary or uses an unsupported text encoding" - i have my doc staved as doc.x and can see it in my explorer under desktop folder.. why won't it work?

    • @learningsoftwareskills
      @learningsoftwareskills  Год назад

      Hi, the docx files shared the video description are word files. So please try to open the files in Microsoft word or libreoffice.
      Hope this helps, cheers 👍

  • @varunjoshi312
    @varunjoshi312 2 года назад +2

    Very informative video..Can you please tell what modifications should be done in this to integrate with a CSV file/excel ?(Suppose we need to generate certificates for internship candidates)

    • @learningsoftwareskills
      @learningsoftwareskills  2 года назад +1

      Hi, unfortunately this solution only works with word template. You can use libraries like openpyxl for populating templates in Excel files
      Hope this helps, cheers 👍

  • @jimmypoopap
    @jimmypoopap 2 года назад +2

    I'm trying to link where (in the dictionary) sNo is k+1, but item.sNo doesn't appear in the template word file. I can see the column, but no variable reference to it? Does it read the header? The header is s.No instead of sNo.

    • @learningsoftwareskills
      @learningsoftwareskills  2 года назад

      Hi, I understood your question. Actually the serial number is auto generated by word. We did not send serial number variable in the context rows.
      Please download and see the template word file. If you are not comfortable with this, you can also use the serial number as a variable in each context object row.
      Hope this helps 👍

  • @liweipeng9106
    @liweipeng9106 2 года назад +1

    thanks for your sharing.

  • @gangireddykoushik9674
    @gangireddykoushik9674 Год назад +1

    Thankyou you saved me.

  • @gennarovitiello1094
    @gennarovitiello1094 2 года назад +5

    Great video! Is there any way to automatically add multiple images from a folder? If the number of pictures changes from time to time, I was wondering if you can make the code to add them dinamically into the word file in a table. Congrats for the video anyway:)

    • @learningsoftwareskills
      @learningsoftwareskills  2 года назад +1

      Hi, it is really simple to render a list of images in word file using docxtpl.
      Just create a list of image objects and assign to a context object key.
      Then use word file table to render the list of image objects using for loop.
      That's it.
      I will also try to make a video on this in the future.
      Hope this helps.
      Cheers👍

    • @learningsoftwareskills
      @learningsoftwareskills  2 года назад

      Hi, On this topic, I have created a video at ruclips.net/video/mcZkZvkwgFA/видео.html and blogpost at nagasudhir.blogspot.com/2022/01/render-images-from-folder-in-automated.html

  • @marcelocampos665
    @marcelocampos665 Год назад +1

    Thank you for helping me.

  • @XEQUTE
    @XEQUTE 9 месяцев назад +1

    except for the background noise and the not so good voice quality
    you my dude explained without a hitch and clearly

  • @MrTkBL
    @MrTkBL Год назад +1

    Thant you for this video, I have a question about how I can automate range of rows in salesrows

    • @learningsoftwareskills
      @learningsoftwareskills  Год назад +1

      Hi, the blogpost for this video can be found at nagasudhir.blogspot.com/2021/10/docxtpl-python-library-for-creating.html
      In this example, we have initialized random sales rows and populated in the report template. But for real world problems, the rows can be derived by fetching data from a database or calling an API
      Hope this helps, Cheers👍

    • @MrTkBL
      @MrTkBL Год назад +2

      @@learningsoftwareskills thank you

  • @henryvaldivia3355
    @henryvaldivia3355 8 месяцев назад +1

    Hello my friend. Thanks for your video. I have some questions.
    1.- Is neccesary to put curly braces for replacement?
    2.- In my template (is a resume template) i have 3 bullet list as an sample. Can i remove this list and put my own elements (can be 10+ elements) with docxtpl?
    3.- I have a section "Work Experience" that has Year start and end, company, position and description for each position the candidate worked. It is not in table or bullet list. can i replace this?

    • @learningsoftwareskills
      @learningsoftwareskills  8 месяцев назад +1

      Hi,
      1. curly braces are necessary because it is jinja templating
      2. At 11:40, I have explained how render a list, please refer that
      3. You can replace this the same way using the technique I mentioned at 11:40. You need to render a list of objects where each object has attributes for year start, end, company, position etc.
      Hope this helps, cheers 👍

    • @henryvaldivia3355
      @henryvaldivia3355 8 месяцев назад

      Hi my friend thanks for your replay, i do exactly what you say but i got error saying unrecognized tag tr why this happens?

    • @learningsoftwareskills
      @learningsoftwareskills  8 месяцев назад +1

      @@henryvaldivia3355 hi, download the template word file from the description of this video. Copy paste a table from that word file and customise it as per your requirement. May be this helps👍

  • @TheHelix123
    @TheHelix123 2 года назад +2

    Suppose we need to send letter and a customer has multiple addresses. How can we use python to generate copies equal to the number of address ess? and how can we add a tick a addresses so for example if a person has two address it should be possible to generate two copies and put a tick on the first address in the first copy and put a tick on the second address in the 2nd copy.

    • @learningsoftwareskills
      @learningsoftwareskills  2 года назад

      Hi Arvav, It is definitely possible to create multiple reports from a single template.
      For the use case you mentioned, you can create a report context for each customer address, run a for loop and create a report for each context.
      You can have a variable in each report context that has all customer addresses in an array and a variable that specifies the index of the address to be ticked (Example: index=2 means 2nd address). Based on the address index, you can tick only the specific address in the generated report.
      This is a solution I just made up. You can also create more optimized solutions to solve this problem.
      Hope this helps. Check out the link of the blog post in video description for source code.
      Cheers 👍

    • @TheHelix123
      @TheHelix123 2 года назад +1

      @@learningsoftwareskills could you show us?

    • @learningsoftwareskills
      @learningsoftwareskills  2 года назад

      Hi, my recent blog post and video are on this topic only, you can check the video at ruclips.net/video/KV6iHKhJDdM/видео.html and blog post at nagasudhir.blogspot.com/2022/01/conditional-statements-nested-for-loops.html
      Hope this helps
      Cheers 👍

  • @FNRamone
    @FNRamone 2 года назад +1

    Great video! Thanks a lot. Is that possible the output to be in powerpoint? For example, I have a Word report and to do it the same using a powerpoint output.

    • @learningsoftwareskills
      @learningsoftwareskills  2 года назад

      Hi, nice query. I will search in the internet of there is a library for populating templates in PowerPoint.
      Cheers👍

  • @sandeeps9602
    @sandeeps9602 2 года назад +1

    Hi nice tutorial. Can I do an If-else statement on the word template? Like if there’s no data from the python program then there should be no table created via the word template?

    • @learningsoftwareskills
      @learningsoftwareskills  2 года назад +1

      Hi, I have created a video on how to use conditional statements in docxtpl templates at ruclips.net/video/KV6iHKhJDdM/видео.html
      The blog post is at nagasudhir.blogspot.com/2022/01/conditional-statements-nested-for-loops.html
      Hope this helps
      Cheers👍

  • @ΔιογένηςΚυνικός-ε8κ
    @ΔιογένηςΚυνικός-ε8κ 11 месяцев назад +1

    Μπράβο, μπράβο !!!

  • @shiulipervinurp
    @shiulipervinurp 8 месяцев назад +1

    I am not able to populate less than a symbol using docxtpl. for example "< 1 " gives me output only 1

    • @learningsoftwareskills
      @learningsoftwareskills  8 месяцев назад

      Hi, good question. As per the documentation at docxtpl.readthedocs.io/en/latest/index.html?highlight=escape#escaping-1, this issue is due to escaping of XML characters like "

  • @TempTest-j8c
    @TempTest-j8c Год назад +1

    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.

    • @learningsoftwareskills
      @learningsoftwareskills  Год назад

      Hi, you can create multiple tables using for loop. But the style of all the tables will be the same. If you have a complex scenario, you can create HTML files dynamically using jinja templating. I will try to make a video on this topic in the future
      Cheers 👍

  • @hemavardhansankati1161
    @hemavardhansankati1161 Год назад +1

    How can I add just blank tables without data in it?

    • @learningsoftwareskills
      @learningsoftwareskills  Год назад

      Hi, just keep blank tables in the template word file itself. Does this solve your issue...👍

  • @ammadkhan4687
    @ammadkhan4687 Год назад +1

    Danke!

  • @israrhussainrao8022
    @israrhussainrao8022 2 года назад +1

    How can we add outer border only on table. and how can we add border to paragraph

    • @learningsoftwareskills
      @learningsoftwareskills  2 года назад

      Hi, all the formatting of the table, paragraph etc can be done manually in the word file. docxtpl just populates the data in the template word file.
      hope this helps👍

  • @arpitj07_
    @arpitj07_ 2 года назад +1

    Hi, is there any way to create header and footer ( with page number ) and Table of Content with this library?

    • @learningsoftwareskills
      @learningsoftwareskills  2 года назад

      Hi, you can set page numbers in word template itself and it will appear in the rendered document. We don't need any python programming for that...
      Table of contents can be created programmatically and injected into the document. Or else you can create the table of contents elemnt in the template itself, but user need to manually update the table of contents in that case.
      Hope this helps, Cheers 👍

    • @arpitj07_
      @arpitj07_ 2 года назад +1

      @@learningsoftwareskills thanks brother.

    • @learningsoftwareskills
      @learningsoftwareskills  2 года назад

      @@arpitj07_ any time 👍

  • @wiki-infodevelopment3369
    @wiki-infodevelopment3369 2 года назад +1

    great tuto, but pdf converting doesn't work, No PDF file is generated and no error is shown!?

  • @aneeshjain905
    @aneeshjain905 2 года назад

    Hi, I tried this way of writing to document files but when I open the saved word file I get an error 0x80004005. Could you help me fix that?

    • @learningsoftwareskills
      @learningsoftwareskills  2 года назад

      Hi, It happens sometimes, please create a new word file and copy paste the text and use it. Sometimes it works.
      If still problem exists, then it might be due to the problem in jinja template markup of ur word file.
      You can send me the word file and python code so that I can see what's wrong. My email is learningsoftwareskills@gmail.com.
      Hope this helps👍

  • @Imran20091990
    @Imran20091990 2 года назад +1

    Could you pls do the video for Excel into Pie chart or any other..

    • @learningsoftwareskills
      @learningsoftwareskills  2 года назад +1

      Hi, I did not get what u meant by "excel into pie chart". Could you please elaborate...

    • @Imran20091990
      @Imran20091990 2 года назад +1

      @@learningsoftwareskills Excel contains specifi data like Pass or Fail, just for instance. Instead of giving Excel report if we provide pie chart report. It looks good..

    • @Imran20091990
      @Imran20091990 2 года назад +1

      Based out on Excel data we should provide pie chart report. Both should be available..

    • @learningsoftwareskills
      @learningsoftwareskills  2 года назад +1

      @Imran20091990 Hii, it is achievable. Just read excel data using pandas into a dataframe
      Use that data to create a plot (like pie chart, bar chart etc) using matplotlib and save the image as an image file.
      Use that image file to populate in the report template (watch from 15:42)
      Hope this helps
      Cheers 👍

    • @Imran20091990
      @Imran20091990 2 года назад

      @@learningsoftwareskills Excellent. Thanks.. will try...

  • @excelgreatdmitri587
    @excelgreatdmitri587 2 года назад +1

    Thanks this help my large law firm project go smoothly.
    I don't know if I could contact you to get some help

    • @learningsoftwareskills
      @learningsoftwareskills  2 года назад +1

      Hi, thanks a lot for your encouraging feedback. You can email me at learningsoftwareskills@gmail.com.
      I am very delighted that this content helped you
      Cheers 👍

  • @ΔιογένηςΚυνικός-ε8κ
    @ΔιογένηςΚυνικός-ε8κ 11 месяцев назад +1

    Θα με ενδιέφερε να δω πώς θα εισάγω df Pandas μέσα σε αρχείο word...

    • @learningsoftwareskills
      @learningsoftwareskills  11 месяцев назад

      Actually you can't import pandas dataframe directly into the word file. You need to run a for loop over each pandas row and render the required columns in the template word file table.
      However, i will also try to search if we can create columns dynamically which may make this possible.
      Cheers👍

  • @hakimzerrouki1815
    @hakimzerrouki1815 2 года назад +1

    And python pdf plz

    • @learningsoftwareskills
      @learningsoftwareskills  2 года назад

      Hii, please watch at 18:03 of this video, there pdf report is also explained
      Hope this helps
      Cheers👍

  • @alexdelarge1845
    @alexdelarge1845 2 года назад +1

    im sorry but its so anoying to hear ur intrincated and dificult to understand accent. i wish some normal people do this in porper english not that giberish you speak

    • @learningsoftwareskills
      @learningsoftwareskills  2 года назад

      Hi, thanks for your feedback, please checkout the blogpost at nagasudhir.blogspot.com/2021/10/docxtpl-python-library-for-creating.html if you have issues in understanding the English accent
      Hope this helps, cheers👍