Install in seconds
Install this skill
Copy the command and run it in your terminal. You can review the source before installing.
terminal
git clone https://github.com/CoderWanFeng/python-office

Works with Git. The repository opens in your current directory.

✂️
AutomationPython

Split Excel by Column

by CoderWanFeng

Splits an Excel file into multiple files based on the contents of a specified column, creating one file per unique value. Use when you need to split Excel data by a column field.

1.3K stars297 forksAdded 2026/07/20
officepippypipythonweixin

Documentation

README

split_excel_by_column Skill

按指定列的内容拆分 Excel 文件

功能描述

根据指定列的内容,将一个 Excel 文件拆分为多个 Excel 文件,每个唯一值对应一个新文件。

所属分类

office/skills/excel/split_excel_by_column/

调用方式

from office.skills.excel import split_excel_by_column

split_excel_by_column(
    filepath='./data.xlsx',
    column=0,
    worksheet_name=None
)

参数说明

参数 类型 必填 默认值 说明
filepath str - 需要拆分的 Excel 文件路径
column int - 按哪一列的内容进行拆分(列索引)
worksheet_name str None 指定工作表名称。默认处理第一个工作表

返回值

None

使用示例

from office.skills.excel import split_excel_by_column
# 按第 0 列拆分
split_excel_by_column(filepath='./orders.xlsx', column=0)

原始函数

office.api.excel.split_excel_by_column