使用python,列出代码,将excel1第3行第2列内容输入到Word表格table1的第5行第4列
时间: 2024-05-28 21:09:37 浏览: 11
import openpyxl
from docx import Document
# load Excel file
wb = openpyxl.load_workbook('excel1.xlsx')
ws = wb.active
# get cell value
cell_value = ws.cell(row=3, column=2).value
# load word document
doc = Document('test.docx')
table = doc.tables[0]
# update table cell
table.rows[4].cells[3].text = str(cell_value)
# save word document
doc.save('test.docx')