大旗谷资源网 Design By www.zqyou.com
批量word表格内容提取到excel
批量word表格内容提取到excel

image.png


[Asm] 纯文本查看 复制代码
import osimport reimport docximport openpyxlfrom tkinter import Tk, Label, Button, filedialog# 定义表格数据提取函数def extract_table_data(doc_path, sheet):    doc = docx.Document(doc_path)    for table in doc.tables:        for i, row in enumerate(table.rows):            for j, cell in enumerate(row.cells):                text = re.sub('\s+', ' ', cell.text)                sheet.cell(row=i+1, column=j+1, value=text)# 创建GUI窗口root = Tk()root.title("Word表格批量数据提取到excel by AK黑龙 ")root.geometry("360x240")# 创建标签和按钮控件label = Label(root, text="请选择要处理的Word文件所在文件夹")label.pack(pady=20)def select_folder():    folder_path = filedialog.askdirectory()    if folder_path:        wb = openpyxl.Workbook()        ws = wb.active        ws.title = "assion"        for file_name in os.listdir(folder_path):            if file_name.endswith(".docx"):                doc_path = os.path.join(folder_path, file_name)                extract_table_data(doc_path, ws)        wb.save("AK黑龙2495003337.xlsx")        label.config(text="处理完成!")button = Button(root, text="选择文件夹", command=select_folder)button.pack(pady=20)root.mainloop()

不会运行的 直接下载运行 https://download.csdn.net/download/longyifei12345/87614872
标签:
批量word表格内容提取到excel

大旗谷资源网 Design By www.zqyou.com
广告合作:本站广告合作请联系QQ:858582 申请时备注:广告合作(否则不回)
免责声明:本站文章均来自网站采集或用户投稿,网站不提供任何软件下载或自行开发的软件! 如有用户或公司发现本站内容信息存在侵权行为,请邮件告知! 858582#qq.com
大旗谷资源网 Design By www.zqyou.com

评论“批量word表格内容提取到excel”

暂无批量word表格内容提取到excel的评论...