import os
import glob
path = "/path/to/excel/files"
excel_files = glob.glob(os.path.join(path, "*.xlsx"))
for file in excel_files:
# 进行相关编辑操作
import pandas as pd
excel_file = "path/to/excel/file.xlsx"
df = pd.read_excel(excel_file)
# 进行数据编辑和处理
## 例如,修改某一列的值
df["Column1"] = df["Column1"] * 10
# 将编辑后的数据保存到Excel文件中
df.to_excel(excel_file, index=False)
上一篇:遍历文件列表
下一篇:遍历文件路径以检查目录是否存在