import pandas as pd from pathlib import Path import os import tkinter as tk from tkinter import filedialog from utils.logging_tool.log_control import INFO def save_directory(): root = tk.Tk() root.withdraw() f_path = filedialog.askdirectory() return f_path def save_file(): root = tk.Tk() root.withdraw() f_path = filedialog.asksaveasfilename() return f_path def getfile(dirpath): path = Path(dirpath) file_path_dict = {} for root, dirs, files in os.walk(dirpath): for file in files: if file.endswith("xlsx") or file.endswith("csv"): file_path_dict[file] = (path / file) return file_path_dict def merge2excel(dir_path, output_file, xlsxSuffix=".xlsx"): """ :param dir_path: 存放excel文件的位置 :param output_file: 输出合并后excel文件的位置 :return: 没有返回值 """ if not output_file.endswith(xlsxSuffix): raise Ex
python操作excel -->(把多个excel文件合并以sheet的展示)
最新推荐文章于 2023-07-10 14:34:45 发布