luckiness
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\')

 

分类:

技术点:

相关文章: