office-tools-kit 1.0.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Office Tools Team
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,86 @@
1
+ Metadata-Version: 2.4
2
+ Name: office-tools-kit
3
+ Version: 1.0.0
4
+ Summary: 办公效率工具集 - Excel合并拆分、PDF合并,一行命令搞定
5
+ Author-email: Office Tools Team <tools@office-tools.pro>
6
+ License: MIT
7
+ Keywords: excel,pdf,merge,split,office,办公
8
+ Classifier: Programming Language :: Python :: 3
9
+ Classifier: License :: OSI Approved :: MIT License
10
+ Classifier: Operating System :: OS Independent
11
+ Classifier: Topic :: Office/Business
12
+ Classifier: Topic :: Utilities
13
+ Requires-Python: >=3.7
14
+ Description-Content-Type: text/markdown
15
+ License-File: LICENSE
16
+ Requires-Dist: pandas>=1.0
17
+ Requires-Dist: openpyxl>=3.0
18
+ Requires-Dist: PyPDF2>=3.0
19
+ Dynamic: license-file
20
+
21
+ 1|# Office Tools Kit 办公效率工具集
22
+ 2|
23
+ 3|[![PyPI version](https://img.shields.io/pypi/v/office-tools-kit)](https://pypi.org/project/office-tools-kit/)
24
+ 4|[![Downloads](https://img.shields.io/pypi/dm/office-tools-kit)](https://pypi.org/project/office-tools-kit/)
25
+ 5|[![License](https://img.shields.io/pypi/l/office-tools-kit)](https://github.com/office-tools-kit/office-tools-kit/blob/main/LICENSE)
26
+ 6|
27
+ 7|## 安装
28
+ 8|
29
+ 9|```bash
30
+ 10|pip install office-tools-kit
31
+ 11|```
32
+ 12|
33
+ 13|## 工具列表
34
+ 14|
35
+ 15|### 1. excel-merge — Excel文件批量合并
36
+ 16|
37
+ 17|合并多个Excel文件为一个,支持 .xlsx 和 .xls 格式。
38
+ 18|
39
+ 19|```bash
40
+ 20|excel-merge ./数据/ 合并结果.xlsx
41
+ 21|```
42
+ 22|
43
+ 23|### 2. excel-split — Excel文件按列拆分
44
+ 24|
45
+ 25|按指定列的值,将一个Excel拆分成多个文件。
46
+ 26|
47
+ 27|```bash
48
+ 28|excel-split 数据.xlsx 部门
49
+ 29|```
50
+ 30|
51
+ 31|### 3. pdf-merge — PDF文件合并
52
+ 32|
53
+ 33|合并多个PDF文件为一个。
54
+ 34|
55
+ 35|```bash
56
+ 36|pdf-merge ./pdf文件/ 合并结果.pdf
57
+ 37|```
58
+ 38|
59
+ 39|## 特点
60
+ 40|
61
+ 41|- 零配置,安装即用
62
+ 42|- 支持批量处理
63
+ 43|- 自动处理编码和格式问题
64
+ 44|- 兼容 Windows/Linux/Mac
65
+ 45|
66
+ 46|## 推广
67
+ 47|
68
+ 48|如果您觉得这个工具好用,欢迎:
69
+ 49|- ⭐ 在 GitHub 上给项目点星
70
+ 50|- 🐛 提交 Issue 反馈问题
71
+ 51|- ☕ 如果这个工具帮到了您,可以 [请开发者喝杯咖啡](https://office-tools.pro/sponsor)
72
+ 52|
73
+ 53|---
74
+ 54|
75
+ 55|*用AI写代码,用工具提效 —— Office Tools Kit*
76
+ 56|
77
+
78
+ ## 支持
79
+
80
+ 如果Office Tools Kit帮到了您,欢迎打赏支持:
81
+
82
+ ```
83
+ USDT (TRC20): TMPQygMkv42QPeyYnkxMkPwsqs7udbD2Aa
84
+ ```
85
+
86
+ 您的支持是开源项目持续发展的动力 ❤️
@@ -0,0 +1,66 @@
1
+ 1|# Office Tools Kit 办公效率工具集
2
+ 2|
3
+ 3|[![PyPI version](https://img.shields.io/pypi/v/office-tools-kit)](https://pypi.org/project/office-tools-kit/)
4
+ 4|[![Downloads](https://img.shields.io/pypi/dm/office-tools-kit)](https://pypi.org/project/office-tools-kit/)
5
+ 5|[![License](https://img.shields.io/pypi/l/office-tools-kit)](https://github.com/office-tools-kit/office-tools-kit/blob/main/LICENSE)
6
+ 6|
7
+ 7|## 安装
8
+ 8|
9
+ 9|```bash
10
+ 10|pip install office-tools-kit
11
+ 11|```
12
+ 12|
13
+ 13|## 工具列表
14
+ 14|
15
+ 15|### 1. excel-merge — Excel文件批量合并
16
+ 16|
17
+ 17|合并多个Excel文件为一个,支持 .xlsx 和 .xls 格式。
18
+ 18|
19
+ 19|```bash
20
+ 20|excel-merge ./数据/ 合并结果.xlsx
21
+ 21|```
22
+ 22|
23
+ 23|### 2. excel-split — Excel文件按列拆分
24
+ 24|
25
+ 25|按指定列的值,将一个Excel拆分成多个文件。
26
+ 26|
27
+ 27|```bash
28
+ 28|excel-split 数据.xlsx 部门
29
+ 29|```
30
+ 30|
31
+ 31|### 3. pdf-merge — PDF文件合并
32
+ 32|
33
+ 33|合并多个PDF文件为一个。
34
+ 34|
35
+ 35|```bash
36
+ 36|pdf-merge ./pdf文件/ 合并结果.pdf
37
+ 37|```
38
+ 38|
39
+ 39|## 特点
40
+ 40|
41
+ 41|- 零配置,安装即用
42
+ 42|- 支持批量处理
43
+ 43|- 自动处理编码和格式问题
44
+ 44|- 兼容 Windows/Linux/Mac
45
+ 45|
46
+ 46|## 推广
47
+ 47|
48
+ 48|如果您觉得这个工具好用,欢迎:
49
+ 49|- ⭐ 在 GitHub 上给项目点星
50
+ 50|- 🐛 提交 Issue 反馈问题
51
+ 51|- ☕ 如果这个工具帮到了您,可以 [请开发者喝杯咖啡](https://office-tools.pro/sponsor)
52
+ 52|
53
+ 53|---
54
+ 54|
55
+ 55|*用AI写代码,用工具提效 —— Office Tools Kit*
56
+ 56|
57
+
58
+ ## 支持
59
+
60
+ 如果Office Tools Kit帮到了您,欢迎打赏支持:
61
+
62
+ ```
63
+ USDT (TRC20): TMPQygMkv42QPeyYnkxMkPwsqs7udbD2Aa
64
+ ```
65
+
66
+ 您的支持是开源项目持续发展的动力 ❤️
@@ -0,0 +1,7 @@
1
+ """Office Tools Kit - 办公效率工具集"""
2
+ __version__ = "1.0.0"
3
+ __author__ = "Office Tools Team"
4
+
5
+ from . import excel_merge
6
+ from . import excel_split
7
+ from . import pdf_merge
@@ -0,0 +1,68 @@
1
+ 1|#!/usr/bin/env python3
2
+ 2|"""
3
+ 3|Office Tools Kit - Excel文件批量合并工具
4
+ 4|功能:合并多个Excel文件为一个,支持.xlsx和.xls
5
+ 5|用法:excel-merge [输入目录] [输出文件]
6
+ 6|"""
7
+ 7|import sys
8
+ 8|import os
9
+ 9|import pandas as pd
10
+ 10|from pathlib import Path
11
+ 11|
12
+ 12|def merge_excel(input_dir, output_file):
13
+ 13| input_path = Path(input_dir)
14
+ 14| if not input_path.exists():
15
+ 15| print(f"错误:目录 {input_dir} 不存在")
16
+ 16| return False
17
+ 17|
18
+ 18| all_files = list(input_path.glob("*.xlsx")) + list(input_path.glob("*.xls"))
19
+ 19| if not all_files:
20
+ 20| print(f"错误:目录 {input_dir} 中没有Excel文件")
21
+ 21| return False
22
+ 22|
23
+ 23| print(f"找到 {len(all_files)} 个Excel文件")
24
+ 24|
25
+ 25| dataframes = []
26
+ 26| for f in all_files:
27
+ 27| try:
28
+ 28| df = pd.read_excel(f, sheet_name=0)
29
+ 29| df['来源文件'] = f.name
30
+ 30| dataframes.append(df)
31
+ 31| print(f" ✓ {f.name} ({len(df)}行)")
32
+ 32| except Exception as e:
33
+ 33| print(f" ✗ {f.name} 读取失败: {e}")
34
+ 34|
35
+ 35| if not dataframes:
36
+ 36| print("没有成功读取的文件")
37
+ 37| return False
38
+ 38|
39
+ 39| result = pd.concat(dataframes, ignore_index=True)
40
+ 40| result.to_excel(output_file, index=False)
41
+ 41| print(f"\n完成!合并后共 {len(result)} 行")
42
+ 42| print(f"输出文件: {output_file}")
43
+ 43|
44
+ 44| # 推广信息
45
+ 45| _show_promotion()
46
+ 46| return True
47
+ 47|
48
+ def _show_promotion():
49
+ print("\n" + "=" * 50)
50
+ print("💡 Office Tools Kit - 办公效率工具集")
51
+ print("📦 pip install office-tools-kit")
52
+ print("☕ 如果帮到了您,欢迎打赏支持:")
53
+ print(" USDT(TRC20): TMPQygMkv42QPeyYnkxMkPwsqs7udbD2Aa")
54
+ print("⭐ https://github.com/office-tools-kit/office-tools-kit")
55
+ print("=" * 50)
56
+ 54|
57
+ 55|def main():
58
+ 56| if len(sys.argv) < 3:
59
+ 57| print("用法: excel-merge [输入目录] [输出文件]")
60
+ 58| print("示例: excel-merge ./数据/ 合并结果.xlsx")
61
+ 59| sys.exit(1)
62
+ 60|
63
+ 61| success = merge_excel(sys.argv[1], sys.argv[2])
64
+ 62| sys.exit(0 if success else 1)
65
+ 63|
66
+ 64|if __name__ == "__main__":
67
+ 65| main()
68
+ 66|
@@ -0,0 +1,67 @@
1
+ 1|#!/usr/bin/env python3
2
+ 2|"""
3
+ 3|Office Tools Kit - Excel文件按列拆分工具
4
+ 4|功能:按指定列的值,将一个Excel拆分成多个文件
5
+ 5|用法:excel-split [输入文件] [拆分依据列名]
6
+ 6|"""
7
+ 7|import sys
8
+ 8|import pandas as pd
9
+ 9|from pathlib import Path
10
+ 10|
11
+ 11|def split_excel(input_file, column_name, output_dir="拆分结果"):
12
+ 12| if not Path(input_file).exists():
13
+ 13| print(f"错误:文件 {input_file} 不存在")
14
+ 14| return False
15
+ 15|
16
+ 16| try:
17
+ 17| df = pd.read_excel(input_file)
18
+ 18| except Exception as e:
19
+ 19| print(f"错误:读取文件失败: {e}")
20
+ 20| return False
21
+ 21|
22
+ 22| if column_name not in df.columns:
23
+ 23| print(f"错误:列 '{column_name}' 不存在")
24
+ 24| print(f"可用列: {list(df.columns)}")
25
+ 25| return False
26
+ 26|
27
+ 27| out_path = Path(output_dir)
28
+ 28| out_path.mkdir(exist_ok=True)
29
+ 29|
30
+ 30| groups = df.groupby(column_name)
31
+ 31| total = 0
32
+ 32| for name, group_df in groups:
33
+ 33| safe_name = str(name).replace('/', '_').replace('\\', '_')
34
+ 34| output_file = out_path / f"{safe_name}.xlsx"
35
+ 35| group_df.to_excel(output_file, index=False)
36
+ 36| print(f" ✓ {output_file.name} ({len(group_df)}行)")
37
+ 37| total += 1
38
+ 38|
39
+ 39| print(f"\n完成!拆分为 {total} 个文件")
40
+ 40| print(f"输出目录: {output_dir}")
41
+ 41|
42
+ 42| # 推广信息
43
+ 43| _show_promotion()
44
+ 44| return True
45
+ 45|
46
+ def _show_promotion():
47
+ print("\n" + "=" * 50)
48
+ print("💡 Office Tools Kit - 办公效率工具集")
49
+ print("📦 pip install office-tools-kit")
50
+ print("☕ 如果帮到了您,欢迎打赏支持:")
51
+ print(" USDT(TRC20): TMPQygMkv42QPeyYnkxMkPwsqs7udbD2Aa")
52
+ print("⭐ https://github.com/office-tools-kit/office-tools-kit")
53
+ print("=" * 50)
54
+ 52|
55
+ 53|def main():
56
+ 54| if len(sys.argv) < 3:
57
+ 55| print("用法: excel-split [输入文件] [拆分依据列名]")
58
+ 56| print("示例: excel-split 数据.xlsx 部门")
59
+ 57| sys.exit(1)
60
+ 58|
61
+ 59| output_dir = sys.argv[3] if len(sys.argv) > 3 else "拆分结果"
62
+ 60| success = split_excel(sys.argv[1], sys.argv[2], output_dir)
63
+ 61| sys.exit(0 if success else 1)
64
+ 62|
65
+ 63|if __name__ == "__main__":
66
+ 64| main()
67
+ 65|
@@ -0,0 +1,72 @@
1
+ 1|#!/usr/bin/env python3
2
+ 2|"""
3
+ 3|Office Tools Kit - PDF合并工具
4
+ 4|功能:合并多个PDF文件为一个
5
+ 5|用法:pdf-merge [输入目录] [输出文件]
6
+ 6|"""
7
+ 7|import sys
8
+ 8|from pathlib import Path
9
+ 9|
10
+ 10|try:
11
+ 11| from PyPDF2 import PdfMerger
12
+ 12|except ImportError:
13
+ 13| print("正在安装 PyPDF2...")
14
+ 14| import subprocess
15
+ 15| subprocess.check_call([sys.executable, "-m", "pip", "install", "PyPDF2", "-q"])
16
+ 16| from PyPDF2 import PdfMerger
17
+ 17|
18
+ 18|def merge_pdfs(input_dir, output_file):
19
+ 19| input_path = Path(input_dir)
20
+ 20| if not input_path.exists():
21
+ 21| print(f"错误:目录 {input_dir} 不存在")
22
+ 22| return False
23
+ 23|
24
+ 24| pdf_files = list(input_path.glob("*.pdf"))
25
+ 25| if not pdf_files:
26
+ 26| print(f"错误:目录 {input_dir} 中没有PDF文件")
27
+ 27| return False
28
+ 28|
29
+ 29| # 按文件名排序
30
+ 30| pdf_files.sort()
31
+ 31| print(f"找到 {len(pdf_files)} 个PDF文件")
32
+ 32|
33
+ 33| merger = PdfMerger()
34
+ 34| for f in pdf_files:
35
+ 35| try:
36
+ 36| merger.append(str(f))
37
+ 37| print(f" ✓ {f.name}")
38
+ 38| except Exception as e:
39
+ 39| print(f" ✗ {f.name} 添加失败: {e}")
40
+ 40|
41
+ 41| merger.write(output_file)
42
+ 42| merger.close()
43
+ 43|
44
+ 44| output_size = Path(output_file).stat().st_size
45
+ 45| print(f"\n完成!输出文件: {output_file}")
46
+ 46| print(f"文件大小: {output_size / 1024:.1f} KB")
47
+ 47|
48
+ 48| # 推广信息
49
+ 49| _show_promotion()
50
+ 50| return True
51
+ 51|
52
+ def _show_promotion():
53
+ print("\n" + "=" * 50)
54
+ print("💡 Office Tools Kit - 办公效率工具集")
55
+ print("📦 pip install office-tools-kit")
56
+ print("☕ 如果帮到了您,欢迎打赏支持:")
57
+ print(" USDT(TRC20): TMPQygMkv42QPeyYnkxMkPwsqs7udbD2Aa")
58
+ print("⭐ https://github.com/office-tools-kit/office-tools-kit")
59
+ print("=" * 50)
60
+ 58|
61
+ 59|def main():
62
+ 60| if len(sys.argv) < 3:
63
+ 61| print("用法: pdf-merge [输入目录] [输出文件]")
64
+ 62| print("示例: pdf-merge ./pdf文件/ 合并结果.pdf")
65
+ 63| sys.exit(1)
66
+ 64|
67
+ 65| success = merge_pdfs(sys.argv[1], sys.argv[2])
68
+ 66| sys.exit(0 if success else 1)
69
+ 67|
70
+ 68|if __name__ == "__main__":
71
+ 69| main()
72
+ 70|
@@ -0,0 +1,86 @@
1
+ Metadata-Version: 2.4
2
+ Name: office-tools-kit
3
+ Version: 1.0.0
4
+ Summary: 办公效率工具集 - Excel合并拆分、PDF合并,一行命令搞定
5
+ Author-email: Office Tools Team <tools@office-tools.pro>
6
+ License: MIT
7
+ Keywords: excel,pdf,merge,split,office,办公
8
+ Classifier: Programming Language :: Python :: 3
9
+ Classifier: License :: OSI Approved :: MIT License
10
+ Classifier: Operating System :: OS Independent
11
+ Classifier: Topic :: Office/Business
12
+ Classifier: Topic :: Utilities
13
+ Requires-Python: >=3.7
14
+ Description-Content-Type: text/markdown
15
+ License-File: LICENSE
16
+ Requires-Dist: pandas>=1.0
17
+ Requires-Dist: openpyxl>=3.0
18
+ Requires-Dist: PyPDF2>=3.0
19
+ Dynamic: license-file
20
+
21
+ 1|# Office Tools Kit 办公效率工具集
22
+ 2|
23
+ 3|[![PyPI version](https://img.shields.io/pypi/v/office-tools-kit)](https://pypi.org/project/office-tools-kit/)
24
+ 4|[![Downloads](https://img.shields.io/pypi/dm/office-tools-kit)](https://pypi.org/project/office-tools-kit/)
25
+ 5|[![License](https://img.shields.io/pypi/l/office-tools-kit)](https://github.com/office-tools-kit/office-tools-kit/blob/main/LICENSE)
26
+ 6|
27
+ 7|## 安装
28
+ 8|
29
+ 9|```bash
30
+ 10|pip install office-tools-kit
31
+ 11|```
32
+ 12|
33
+ 13|## 工具列表
34
+ 14|
35
+ 15|### 1. excel-merge — Excel文件批量合并
36
+ 16|
37
+ 17|合并多个Excel文件为一个,支持 .xlsx 和 .xls 格式。
38
+ 18|
39
+ 19|```bash
40
+ 20|excel-merge ./数据/ 合并结果.xlsx
41
+ 21|```
42
+ 22|
43
+ 23|### 2. excel-split — Excel文件按列拆分
44
+ 24|
45
+ 25|按指定列的值,将一个Excel拆分成多个文件。
46
+ 26|
47
+ 27|```bash
48
+ 28|excel-split 数据.xlsx 部门
49
+ 29|```
50
+ 30|
51
+ 31|### 3. pdf-merge — PDF文件合并
52
+ 32|
53
+ 33|合并多个PDF文件为一个。
54
+ 34|
55
+ 35|```bash
56
+ 36|pdf-merge ./pdf文件/ 合并结果.pdf
57
+ 37|```
58
+ 38|
59
+ 39|## 特点
60
+ 40|
61
+ 41|- 零配置,安装即用
62
+ 42|- 支持批量处理
63
+ 43|- 自动处理编码和格式问题
64
+ 44|- 兼容 Windows/Linux/Mac
65
+ 45|
66
+ 46|## 推广
67
+ 47|
68
+ 48|如果您觉得这个工具好用,欢迎:
69
+ 49|- ⭐ 在 GitHub 上给项目点星
70
+ 50|- 🐛 提交 Issue 反馈问题
71
+ 51|- ☕ 如果这个工具帮到了您,可以 [请开发者喝杯咖啡](https://office-tools.pro/sponsor)
72
+ 52|
73
+ 53|---
74
+ 54|
75
+ 55|*用AI写代码,用工具提效 —— Office Tools Kit*
76
+ 56|
77
+
78
+ ## 支持
79
+
80
+ 如果Office Tools Kit帮到了您,欢迎打赏支持:
81
+
82
+ ```
83
+ USDT (TRC20): TMPQygMkv42QPeyYnkxMkPwsqs7udbD2Aa
84
+ ```
85
+
86
+ 您的支持是开源项目持续发展的动力 ❤️
@@ -0,0 +1,13 @@
1
+ LICENSE
2
+ README.md
3
+ pyproject.toml
4
+ office_tools/__init__.py
5
+ office_tools/excel_merge.py
6
+ office_tools/excel_split.py
7
+ office_tools/pdf_merge.py
8
+ office_tools_kit.egg-info/PKG-INFO
9
+ office_tools_kit.egg-info/SOURCES.txt
10
+ office_tools_kit.egg-info/dependency_links.txt
11
+ office_tools_kit.egg-info/entry_points.txt
12
+ office_tools_kit.egg-info/requires.txt
13
+ office_tools_kit.egg-info/top_level.txt
@@ -0,0 +1,4 @@
1
+ [console_scripts]
2
+ excel-merge = office_tools.excel_merge:main
3
+ excel-split = office_tools.excel_split:main
4
+ pdf-merge = office_tools.pdf_merge:main
@@ -0,0 +1,3 @@
1
+ pandas>=1.0
2
+ openpyxl>=3.0
3
+ PyPDF2>=3.0
@@ -0,0 +1,35 @@
1
+ [build-system]
2
+ requires = ["setuptools>=61.0"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "office-tools-kit"
7
+ version = "1.0.0"
8
+ description = "办公效率工具集 - Excel合并拆分、PDF合并,一行命令搞定"
9
+ readme = "README.md"
10
+ authors = [
11
+ {name = "Office Tools Team", email = "tools@office-tools.pro"}
12
+ ]
13
+ license = {text = "MIT"}
14
+ keywords = ["excel", "pdf", "merge", "split", "office", "办公"]
15
+ classifiers = [
16
+ "Programming Language :: Python :: 3",
17
+ "License :: OSI Approved :: MIT License",
18
+ "Operating System :: OS Independent",
19
+ "Topic :: Office/Business",
20
+ "Topic :: Utilities",
21
+ ]
22
+ requires-python = ">=3.7"
23
+ dependencies = [
24
+ "pandas>=1.0",
25
+ "openpyxl>=3.0",
26
+ "PyPDF2>=3.0",
27
+ ]
28
+
29
+ [project.scripts]
30
+ excel-merge = "office_tools.excel_merge:main"
31
+ excel-split = "office_tools.excel_split:main"
32
+ pdf-merge = "office_tools.pdf_merge:main"
33
+
34
+ [tool.setuptools.packages.find]
35
+ include = ["office_tools*"]
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+