Extracting tables from a DOCX Word document in python

后端 未结 2 1973
孤独总比滥情好
孤独总比滥情好 2021-01-13 07:26

I\'m trying to extract a content of tables in DOCX Word document, and boy I\'m new to xml/xpath.

from docx import *
document = opendocx(\'someFile.docx\')
ta         


        
2条回答
  •  天命终不由人
    2021-01-13 07:45

    You can extract the table from docx using python-docx. Check the following code:

    from docx import Document()
    document = Document(file_path)
    
    tables = document.tables
    

提交回复
热议问题