from docx.api import Document
import pandas as pd
document = Document("D:/tmp/test.docx")
tables = document.tables
df = pd.DataFrame()
for table in document.tables:
for row in table.rows:
text = [cell.text for cell in row.cells]
df = df.append([text], ignore_index=True)
df.columns = ["Column1", "Column2"]
df.to_excel("D:/tmp/test.xlsx")
print df
Output
`>>>
Column1 Column2
0 Hello TEST
1 Est Ting
2 Gg ff
How to remove row and column 0,1,2 and how to add some images in this codes?