Advanced Python Programming: Reading and Writing to Documents with docx

แชร์
ฝัง
  • เผยแพร่เมื่อ 25 ธ.ค. 2024

ความคิดเห็น • 128

  • @Sarikni_ukasi
    @Sarikni_ukasi 3 ปีที่แล้ว +3

    That’s exactly what I was looking for today. God willing

  • @bmansan
    @bmansan ปีที่แล้ว

    Awesome. Just the explanation about "runs" already made me understand the documentation.
    Thanks a lot 🎉

  • @Galvis18
    @Galvis18 4 ปีที่แล้ว +6

    Hi, where's the rest of these tutorials about writing with Docx, can't find them!... Thanks!

  • @johnsmith-tc5um
    @johnsmith-tc5um 7 ปีที่แล้ว +2

    high level of positivity over here, very useful guide thanks!

  • @SandanuwanDhanushka
    @SandanuwanDhanushka 3 ปีที่แล้ว +1

    Good job! Subscribed! Would like to see more unique content like this. Thanks!

  • @santiagocollados8986
    @santiagocollados8986 3 ปีที่แล้ว

    oh my gosh! So simple!!! Awesome! Heap of thanks!

  • @undefined36
    @undefined36 5 ปีที่แล้ว +2

    Hello Avi,
    Good video :)
    Is it possible to copy the content(like copying 4.1 section which has table and few lines) from doc file and paste in other file.
    please help me.

  • @shivanshjayara6372
    @shivanshjayara6372 3 ปีที่แล้ว

    @5:06 why at index 1 runs do not consider python programming together? Though it is having same size and format?

  • @ashishkumawat6110
    @ashishkumawat6110 3 ปีที่แล้ว

    Awesome tutorial dude! keep it up

  • @ayushthapamangar801
    @ayushthapamangar801 2 ปีที่แล้ว +1

    the vid starts from5:50

  • @Srikanth-Ryali
    @Srikanth-Ryali 3 ปีที่แล้ว

    HI, Thx lot ..Any idea on how to extract page no from word document using python

  • @witekgreg
    @witekgreg 6 ปีที่แล้ว +5

    Hi Avi, thanks for great course! Could you please continue with python-docx serie? Do you know how can I split table in word? I would like to use something like VBA "selection.SplitTable", but I cannot find anything similar to break one big table to smaller ones

  • @jensknaack9016
    @jensknaack9016 3 ปีที่แล้ว

    Very good tutorial. Thank you.

  • @Emlop1
    @Emlop1 5 ปีที่แล้ว +3

    Fantastic !

  • @limodog779
    @limodog779 2 ปีที่แล้ว +1

    hi there, when i do pip3 install, it doesnt work and gives me the message"pip3 : The term 'pip3' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or
    if a path was included, verify that the path is correct and try again.
    At line:1 char:1
    + pip3 install python-docx
    + ~~~~
    + CategoryInfo : ObjectNotFound: (pip3:String) [], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException" i would appreciate help!

  • @shivakumarag3226
    @shivakumarag3226 7 หลายเดือนก่อน

    How can i find and change the certain text font size from existing paragraph by using python-docx?? Any help would be great save for me.

  • @feRy3537
    @feRy3537 5 ปีที่แล้ว

    Very useful intro to docx module, thank you!

  • @mrkeinzi
    @mrkeinzi 2 ปีที่แล้ว

    Is it possible to update the table of content ?

  • @abdullahihsan1387
    @abdullahihsan1387 4 ปีที่แล้ว

    great tutorial but i just have one question. how do you change the font and font size?

  • @gurnihalsingh5752
    @gurnihalsingh5752 4 ปีที่แล้ว

    Do you know how to get the program to read numbering , bullet points etc. ?

  • @ManuelSoutoPico
    @ManuelSoutoPico 3 ปีที่แล้ว

    Very nice! How would you extract highlighted text from a Word document?

  • @abhilashdas2588
    @abhilashdas2588 4 ปีที่แล้ว

    You are a good orator....Fantastic really....!

  • @AsadKhan-cw6ue
    @AsadKhan-cw6ue 4 ปีที่แล้ว

    how can we add water mark to our documents by this module ?

  • @kcvinu
    @kcvinu 4 ปีที่แล้ว +1

    Thanks for the video. What about tables in word ? Could you please make a video on how to read from word table and write to word table ?

  • @anthonyudeagbala8558
    @anthonyudeagbala8558 4 ปีที่แล้ว

    Hi, thanks for making this tutorial.
    I for one is facing the challenge of adding an image side by side. That is not adding an image in a new paragraph. How can I do this?

  • @ollehawes3059
    @ollehawes3059 5 ปีที่แล้ว +1

    Is it possible to change the data in a table to the contents of a .txt file with Python-docx?

  • @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.

  • @JimmyGeniusEllis
    @JimmyGeniusEllis 3 ปีที่แล้ว

    Great thanks man

  • @malikrumi1206
    @malikrumi1206 4 ปีที่แล้ว

    2020-11-11. Video does not start. Might be connected to an issue with the ad that runs before it. That ad does not run, either. I just get the last frame where it says 'click here'. Skip ad just gets the white circle going round and round on the black screen.

  • @frikkievandermerwe
    @frikkievandermerwe 5 ปีที่แล้ว

    Wow! Awesome tutorial!

  • @pavankumark4708
    @pavankumark4708 3 ปีที่แล้ว

    How to set the position of the image in the docx file ?

  • @mustarifinmuhtar1025
    @mustarifinmuhtar1025 3 ปีที่แล้ว

    i have one '.docx', and i want to add a new page on the first page of the document as cover
    how to do this? please help me

  • @alexanderlewzey1102
    @alexanderlewzey1102 6 ปีที่แล้ว

    Really excellent video, great pace, clear explanation, super useful!

  • @JR-ly6bx
    @JR-ly6bx 3 ปีที่แล้ว

    whats the benefit of using python-docx vs accessing the VBA object model with pywin32????

  • @AndyWicks
    @AndyWicks 4 ปีที่แล้ว +1

    Simple to understand, well presented and easy to use - thank you and well done. :-)

  • @harshanamiyuranga3491
    @harshanamiyuranga3491 3 ปีที่แล้ว

    cant we read paragraph in text box with python-dcx ??

  • @CSAMAROK
    @CSAMAROK 3 ปีที่แล้ว

    how can i use input("") inside doc.add_pragraph()?

  • @iklintsov
    @iklintsov 5 ปีที่แล้ว

    nice library, I was wondering if there is a way to get a list of custom fields from docx, so that later I can populate it with some data...

  • @Runawaygeekchannel
    @Runawaygeekchannel 5 ปีที่แล้ว +4

    Oddly, one of the most vital processes for DOCX is understanding the document structure, (Paragraphs, Tables and images) and the order. That order needs to be understood so that when we extract the text and build a new file, such as parsing through a translator, we can rebuild in the same order. its the Document.Story but i can't find anywhere on how to get this detailed out.

  • @thavasigti4290
    @thavasigti4290 2 ปีที่แล้ว

    .docm file does not support this package, any suggestion

  • @PankajKumarShee
    @PankajKumarShee 5 ปีที่แล้ว +2

    Unable to install docx in my macbook. any help will be appreciated.

    • @artificial-alex01101
      @artificial-alex01101 4 ปีที่แล้ว

      Use the Pycharm GUI. Open a project, go to File > Settings > Project: > Project interpreter. Then use the "+" button to add any package you need.

  • @muhammedbayram4624
    @muhammedbayram4624 2 ปีที่แล้ว

    Thanks dude

  • @sonamtseringsherpa
    @sonamtseringsherpa 4 ปีที่แล้ว

    this was simply great and very intresting

  • @alexgora7530
    @alexgora7530 2 ปีที่แล้ว

    Cool 👍 thank you friend ❣️

  • @danilolobo1167
    @danilolobo1167 3 ปีที่แล้ว

    how can I do it on google Colaboratory?

  • @TheCbrown146
    @TheCbrown146 4 ปีที่แล้ว +2

    I'm sorry. I am a bit dense. How is this useful? I can write in word document. I just need some ideas on why I would spend time coding this instead of writing this out on word document.

    • @burdbrains1019
      @burdbrains1019 4 ปีที่แล้ว

      An example would be automating a task, like something that requires you to write a lot of information from an excel file to a word document. If you can program an application that lets you just upload an excel file and write to a word document (as opposed to having to do it all by hand), although initially it may take some time to program, that would save you a lot of time in the long run. Of course this would only be useful if you had to do said task hundreds of times.

  • @blakeyhatcher
    @blakeyhatcher 6 ปีที่แล้ว

    Sorry for asking so many questions but I was wondering if there was a way to read a full page all at once from a document and store a page as an element to an array or something so like if I had a word document with 100 pages could I store each page in one array?

  • @otrolokodemas
    @otrolokodemas 5 ปีที่แล้ว +1

    print variable in the document?
    help me

  • @vinayraoj94
    @vinayraoj94 3 ปีที่แล้ว

    i want to add multiple images to a doc file from a folder. one image per page . How can I do it?

  • @luizeduardo5786
    @luizeduardo5786 5 ปีที่แล้ว

    Hello!
    If have 6 lines and i want to isert a image between line 2 and 3. It's possible ?
    Thanks!

  • @Semilore317
    @Semilore317 2 ปีที่แล้ว

    How exactly do you save a file

  • @joaofolgado3316
    @joaofolgado3316 4 ปีที่แล้ว

    hey ! how can i replace a specific word in a text file ? can you help me ? thanks

  • @pradeep-he9jq
    @pradeep-he9jq 6 ปีที่แล้ว +1

    how can we read .doc files? can we do that with pydocx?

  • @ronit8067
    @ronit8067 7 ปีที่แล้ว

    Hi, I am able to write text to a .txt file just fine. I am extracting values from a excel file and adding them to a huge string which is a message(output to my txt). values from excel (using data frame) are iterated. is there any way to output this data to a docx file.

  • @yalairfan7252
    @yalairfan7252 5 ปีที่แล้ว

    Can I get bold and italic font present in pdf (Which consist images) or image please help.. using any ocr or lib

  • @arunkumars5428
    @arunkumars5428 4 ปีที่แล้ว

    How to add caption for the figure?

  • @j-oy6218
    @j-oy6218 6 ปีที่แล้ว

    Has he posted the next video of it? As he said he is going to show how to work with styles and headings. Please reply me with a link if anyone knows.

  • @creepersbgone
    @creepersbgone 6 ปีที่แล้ว

    My program doesnt find hyperlinks in the docx file, any input on this?

  • @iopltt
    @iopltt 5 ปีที่แล้ว +1

    Fantastic! :-)

  • @achyutkayastha4248
    @achyutkayastha4248 4 ปีที่แล้ว

    FileNotFoundError: [Errno 2] No such file or directory: 'bear.jpg'. why is it not working. I have put the picture in the python files directory. Where else am I supposed to put it.? someone help!

    • @linguini8658
      @linguini8658 4 ปีที่แล้ว

      you probably dont have the picture named "bear.jpg"

  • @blakeyhatcher
    @blakeyhatcher 6 ปีที่แล้ว

    What text editor is that that you are writing your code on?

    • @TheCodex
      @TheCodex  6 ปีที่แล้ว

      PyCharm! There's a free to download community version online.

    • @blakeyhatcher
      @blakeyhatcher 6 ปีที่แล้ว

      The Codex awesome thanks

    • @kmp922
      @kmp922 4 ปีที่แล้ว

      @@TheCodex I want to join docx rest of the video's . Please help me

  • @DA-dh5vf
    @DA-dh5vf 5 ปีที่แล้ว

    Can you please make a video you on reading data from XML and writing to a table in word document ?

  • @Leela_Karthik
    @Leela_Karthik 3 ปีที่แล้ว

    how to add list bullet to an existing document which doesn't have that style

  • @afaqurrehmankhan3133
    @afaqurrehmankhan3133 4 ปีที่แล้ว

    I need help in python , where should I contact you?

  • @siddarthbali12
    @siddarthbali12 4 ปีที่แล้ว

    It doesn't work for .doc format, what's the work around for .doc format????

  • @josereynelchauxperez947
    @josereynelchauxperez947 7 ปีที่แล้ว

    Excelente material, muchas gracias !!!

  • @ekremberkmen
    @ekremberkmen 6 ปีที่แล้ว

    Thanks for the great tutorial. Could you explain how to change the fonts of a run? Or making a run bold or italic

    • @vipink3670
      @vipink3670 4 ปีที่แล้ว +1

      p.add_run('bold').bold = True
      p.add_run(' and some ')
      p.add_run('italic.').italic = True

  • @alejandrobeltran6889
    @alejandrobeltran6889 6 ปีที่แล้ว

    thank you very much for the information, it is very good.

  • @alexey_starshin
    @alexey_starshin 7 ปีที่แล้ว

    Very usefull, thank you.

  • @gaganmittal7332
    @gaganmittal7332 6 ปีที่แล้ว

    is there any method to convert the unstructured text file to excel??

  • @adityasher
    @adityasher 4 ปีที่แล้ว +1

    how can I repalce text?

    • @Hunterrrr11
      @Hunterrrr11 4 ปีที่แล้ว

      I need to know, too. someone pls help

  • @infreezydark
    @infreezydark 5 ปีที่แล้ว

    why does docx not show any methods on pycharm? when I do doc. I only get if, while etc.. I don't add_paragraphs etc

    • @cgthejesh
      @cgthejesh 5 ปีที่แล้ว

      Even I had same question, but in his tutorial it gives out the list of methods Strange. I use pycharm editor

  • @narendrapatidar
    @narendrapatidar 3 ปีที่แล้ว

    how to remove black space in doc with pthon, It is empty line (paragraph)

  • @4ZaKing
    @4ZaKing 5 ปีที่แล้ว +6

    Really nice. Maybe even "Fantastic!" =)
    Seems like it is "python-docx" when installing also in python 2 now by the way.

    • @theojudson1389
      @theojudson1389 3 ปีที่แล้ว

      i dont mean to be off topic but does anybody know a way to get back into an Instagram account??
      I was stupid forgot my account password. I love any tricks you can give me!

    • @mathiastravis603
      @mathiastravis603 3 ปีที่แล้ว

      @Theo Judson instablaster ;)

    • @theojudson1389
      @theojudson1389 3 ปีที่แล้ว

      @Mathias Travis I really appreciate your reply. I got to the site thru google and Im waiting for the hacking stuff now.
      Seems to take quite some time so I will get back to you later when my account password hopefully is recovered.

    • @theojudson1389
      @theojudson1389 3 ปีที่แล้ว

      @Mathias Travis it worked and I finally got access to my account again. I'm so happy:D
      Thanks so much you saved my account :D

    • @mathiastravis603
      @mathiastravis603 3 ปีที่แล้ว

      @Theo Judson no problem xD

  • @RaulEduardoFloresNajera
    @RaulEduardoFloresNajera 5 ปีที่แล้ว +1

    Excellent

  • @myos2188
    @myos2188 4 ปีที่แล้ว

    how could I work with tables on a Word file?

  • @programminghubph744
    @programminghubph744 4 ปีที่แล้ว

    How can I automagically enter a data in a cell in docx?

  • @vrkv380
    @vrkv380 4 ปีที่แล้ว

    I have an existing docx file(A.docx) and want to do
    the following
    1) copy the custom styles from another docx file(B.docx) to (A.docx) file
    2) want to update the paragraph of the existing docx file(A.docx) with custom styles that i added in STEP-1
    How we can achieve this ?

  • @sonorityscape
    @sonorityscape 6 ปีที่แล้ว

    How could I access a text box?

  • @pushkaringale5700
    @pushkaringale5700 5 ปีที่แล้ว +1

    how to extract image from .docx using python

  • @RameshPatil-mr6rl
    @RameshPatil-mr6rl 5 ปีที่แล้ว

    How to copy the content of one docx to another with all the formatting

  • @globalassistance1050
    @globalassistance1050 6 ปีที่แล้ว

    Is there anyway we can copy the content from one .docx file to another and keep the formatting same..thank you

    • @j-oy6218
      @j-oy6218 6 ปีที่แล้ว

      did u find the way? coz I also want to try this.

    • @antitroll98
      @antitroll98 6 ปีที่แล้ว

      is that even a question? just move with shutil

  • @TheCodex
    @TheCodex  6 ปีที่แล้ว

    Take your skills one step further with The Complete Python Programming Bootcamp! www.thecodex.me/python-bootcamp
    Join THECODEX today! www.thecodex.me

  • @johnmichaeltejada1578
    @johnmichaeltejada1578 4 ปีที่แล้ว

    It didn't work. After I installed the python-docx, ModuleNotFoundError: No module named 'docx', every time I run the program.

    • @danielkessie9921
      @danielkessie9921 4 ปีที่แล้ว

      probably problem with your environment or interpreter. always check where you pip install it, if you have more than one version of python in your pc.

  • @yoshimidilg4818
    @yoshimidilg4818 6 ปีที่แล้ว

    did they come up with different functions since this was posted? doc.paragraph does not work for me

    • @TheCodex
      @TheCodex  6 ปีที่แล้ว

      Hmmm that's really odd - doc.paragraph should definitely work.

    • @j-oy6218
      @j-oy6218 6 ปีที่แล้ว

      has your issue solved?

    • @yarmik3d
      @yarmik3d 6 ปีที่แล้ว

      import docx
      doc = docx.Document('test.docx')
      print(doc.paragraphs[0].text)

    • @yarmik3d
      @yarmik3d 6 ปีที่แล้ว

      Windows, python 3...

    • @bla7091
      @bla7091 6 ปีที่แล้ว

      there is an add_paragraph() method. Try using that on your docx object

  • @luizeduardo5786
    @luizeduardo5786 5 ปีที่แล้ว

    How Can i save using use the name that is in a variable?
    For example:
    A = Luiz
    document.save('A.docx') -> this can't work!
    Can you help me ?

    • @GeorgePatoulis
      @GeorgePatoulis 5 ปีที่แล้ว

      if you're using python 3, write it as:
      document.save('{}.docx'.format(A)) if you're using python 2, it's something with "%"... (I don't quite remember, 'cause I'm new to python, but you can look it up.) Generally, when you want to use a variable name inside a string, that's the way to do it! '{}'.format(variable)

  • @FullPiter
    @FullPiter 4 ปีที่แล้ว

    Could U make more advanced stuff with docx python? I found it actually very useful, and well the basic are very easy and greatyl presented on website of pythondocx but stuff like headings, footers are way harder to understand.

  • @amramilic7680
    @amramilic7680 7 ปีที่แล้ว

    Will this course be available at Udemy and will there be certificate for it as well? I got your "Introduction to Python programming" certificate and the course really helped me a lot to understand Python fundamentals better. Keep up!

  • @udhaykumar4877
    @udhaykumar4877 4 ปีที่แล้ว

    Anyone suggest how to convert HTML page with styles into word document in Django views

  • @Dimanatos
    @Dimanatos 4 ปีที่แล้ว

    NO ME FUNCIONA, ME TIRA ERROR CONSTANTEMENTE CUANDO QUIERO HACER EL DOC = DOCX.DOCUMENT(MIARCHIVO.DOCX) AYUDAAAAAAAAAAAAAAAAAAAA

  • @runthomas
    @runthomas 6 ปีที่แล้ว +1

    how to display the entire docuemnt

    • @clintluna6884
      @clintluna6884 5 ปีที่แล้ว

      Here's code I made to read an entire text document automatically, let me know if you have any questions:
      def docPrinter():
      import docx
      import os
      print("This prints text from a docx document")
      fname=input("Enter the name of the file: ") #must include .docx in the name
      doc=docx.Document(fname)
      i=len(doc.paragraphs)
      for c in range(i):
      print(doc.paragraphs[c].text)
      docPrinter()

  • @mahdiamrollahi8456
    @mahdiamrollahi8456 4 ปีที่แล้ว

    Great....

  • @AbdulWaheed-ib4nm
    @AbdulWaheed-ib4nm 3 ปีที่แล้ว

    Challenge which I face using python-docx package are:
    1) not able to add " table of content ' inside word file.
    2) cross reference not working
    3)hyperlinks not working
    Do you know how i can add table of content ?

  • @shivamsri6784
    @shivamsri6784 3 ปีที่แล้ว

    Dude please tell how to fetch all the data from doc file in one single code

  • @britoroque
    @britoroque 4 ปีที่แล้ว

    Thanks for this video. It's awesome. By the way, do you know how to do the same with odt files?

  • @mahmoudhegazy1530
    @mahmoudhegazy1530 4 ปีที่แล้ว

    super

  • @CommitSNIPS
    @CommitSNIPS 7 ปีที่แล้ว

    Can you please do a tutorial on a cocoa app!

  • @rahasworld
    @rahasworld 4 ปีที่แล้ว

    Why would one want to modify a word document using Python? Why not do it the old fashioned way? I ask in all seriousness

  • @blo0m1985
    @blo0m1985 4 ปีที่แล้ว

    useless as it's not possible edit doc inside, only add to the end of existing file

  • @hazoomeh
    @hazoomeh 6 ปีที่แล้ว

    I can do all of this (and much more) in Word itself.. What is the point of using Python here? It’s a very basic question that you didn’t answer.

    • @blacklilith6696
      @blacklilith6696 6 ปีที่แล้ว

      Maybe when you are working on some automated stuffs you may appreciate this.

    • @burdbrains1019
      @burdbrains1019 4 ปีที่แล้ว

      As said above ^ an example would be automating a task, like something that requires you to write a lot of information from an excel file to a word document. If you can program an application that lets you just upload an excel file and write to a word document (as opposed to having to do it all by hand), although initially it may take some time to program, that would save you a lot of time in the long run. Of course this would only be useful if you had to do said task hundreds of times.