import  pandas
from docx  import  Document
excel=pandas.read_excel(r'F:\word练习\数据.xlsx',header=None)
文件=Document(r'F:\word练习\a.docx')
表=文件.add_table(4,4)
for  行号  in  range(4):
    for  列号  in  range(4):
        表.cell(行号,列号).text=str(excel.iloc[行号,列号])

文件.save(r'F:\word练习\从excel中导入数据到表格.docx')

 

扫码关注我们
微信号:SRE实战
拒绝背锅 运筹帷幄

SRE实战 互联网时代守护先锋,助力企业售后服务体系运筹帷幄!一键直达领取阿里云限量特价优惠。