excel 数据导 word 数据表格实现代码
在代码块中导入 docx 包 import docx
代码块 doc = docx.Document()
t = doc.add_table(lv_1.shape[0]+1, lv_1.shape[1],‘Table Grid’)
for j in range(lv_1.shape[-1]):
t.cell(0,j).text = lv_1.columns[j]
for i in range(lv_1.shape[0]):
for j in range(lv_1.shape[-1]):
t.cell(i+1,j).text = str(lv_1.values[i,j])
doc.save(‘C:\Users\candy\Desktop\test.docx’)
回帖内容已被屏蔽。