C
C
comandante_ktc2021-12-24 20:40:21
Python
comandante_ktc, 2021-12-24 20:40:21

How to extract information from specific table cells of a .docx file using python and the docx library?

It is necessary to extract a certain cell from a table in a docx file (by column heading). I am using the docx library. It seems that I read the documentation, but so far I have not understood anything.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Sergey Gornostaev, 2021-12-24
@comandante_ktc

What is there to understand?

from docx import Document

document = Document('document.docx')
table = document.tables[0]
cell = table.cell(0, 1)
print(cell.text)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question