13 lines
323 B
Python
13 lines
323 B
Python
from docx import Document
|
|
|
|
def extract_tables_from_docx(file_path):
|
|
doc = Document(file_path)
|
|
tables = []
|
|
for table in doc.tables:
|
|
rows = []
|
|
for row in table.rows:
|
|
|
|
cells = [cell.text for cell in row.cells]
|
|
rows.append(cells)
|
|
tables.append(rows)
|
|
return tables |