excel-to-markdown

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Excel 转 Markdown

Excel to Markdown

任务目标

Task Objective

将 Excel 文件(.xlsx/.xlsm)转换为合法的 Markdown 表格格式,用于式样书阅读、上下文提供等场景。
Convert Excel files (.xlsx/.xlsm) into valid Markdown table format, applicable for scenarios such as style guide reading and context provision.

前置依赖

Prerequisites

openpyxl>=3.0.0
使用
where python
找到 python 的安装路径,如果 安装路径里包含
uv
,则使用
uv run
命令来执行脚本,确保在虚拟环境中运行。如果无法找到 python,可以提示用户安装 python 或者使用虚拟环境,然后结束程序。
openpyxl>=3.0.0
Use
where python
to find the Python installation path. If the installation path contains
uv
, use the
uv run
command to execute the script to ensure it runs in a virtual environment. If Python cannot be found, prompt the user to install Python or use a virtual environment, then exit the program.

最佳实践

Best Practices

将项目式样书 Excel 转为 Markdown 后,可直接作为开发任务的上下文:
bash
python scripts/excel_to_markdown_general.py ./式様書.xlsx -o ./式様書.md
如用户没有其他特殊需求,执行上面格式的命令即可,如果有更具体的要求,再看下面的【其他参数】部分。
After converting the project style guide Excel to Markdown, it can be directly used as context for development tasks:
bash
python scripts/excel_to_markdown_general.py ./式様書.xlsx -o ./式様書.md
If the user has no other special requirements, execute the command in the above format. For more specific requirements, refer to the [Other Parameters] section below.

其他参数

Other Parameters

基本转换

Basic Conversion

bash
python scripts/excel_to_markdown_general.py <excel文件> [-o <md文件>]
bash
python scripts/excel_to_markdown_general.py <excel-file> [-o <md-file>]

合并单元格处理模式

Merged Cell Processing Mode

bash
python scripts/excel_to_markdown_general.py <excel文件> --merge-mode tl
  • tl
    (默认):仅在合并区域左上角保留值
  • fill
    :将左上角值填充到合并区域每个子单元格
bash
python scripts/excel_to_markdown_general.py <excel-file> --merge-mode tl
  • tl
    (default): Keep the value only in the top-left corner of the merged area
  • fill
    : Fill the top-left value into each sub-cell of the merged area

输出详细日志

Output Detailed Logs

bash
python scripts/excel_to_markdown_general.py <excel文件> --verbose
bash
python scripts/excel_to_markdown_general.py <excel-file> --verbose

资源索引

Resource Index

  • 核心脚本:scripts/excel_to_markdown_general.py
  • Core Script: scripts/excel_to_markdown_general.py