代码拉取完成,页面将自动刷新
import os
import pandas as pd
def split_excel_sheets(input_excel, output_folder):
# 创建目标文件夹
os.makedirs(output_folder, exist_ok=True)
# 读取包含多个sheet的Excel文件
xl = pd.ExcelFile(input_excel)
# 遍历每个sheet并将其保存为单独的Excel文件
for sheet_name in xl.sheet_names:
df = pd.read_excel(input_excel, sheet_name)
output_file = os.path.join(output_folder, f"{sheet_name}.xlsx")
df.to_excel(output_file, index=False)
# 例子:将input_workbook.xlsx 拆分为多个Excel文件放入output_folder文件夹,每个文件包含一个sheet
split_excel_sheets('input_workbook.xlsx', 'output_folder')
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。