360 Secure SkillHub
360 安全技能中心

Excel Translator

该技能读取 .xlsx 文件,逐单元格把英文文本通过 OpenAI 翻译接口译为中文,译文与原文以换行分隔写回同一单元格,保留合并单元格、字体、颜色与图片,并输出带 _translated 后缀的新文件。

ilove323
ilove323
热度 73.75
最近更新 2026-05-17 12:54:52
分类:效率依赖:代码执行 / 读写文件 / 第三方 API / 内部调用大模型应用场景:翻译 / 文件转换 / 数据处理

安装技能

复制下面的话术发给你的 Agent,它会通过 secure-skills 检索并安装该技能。

执行命令安装此 skill: npx secure-skills-cli add excel-translator
Metadata
name
excel-translator
description
Translates Excel files (.xlsx) from English to Chinese while preserving all formatting, images, and charts. Use for any task where a user provides an Excel file and requests English-to-Chinese translation.

Excel Translator Skill

Overview

This skill translates the text content of an Excel file (.xlsx) from English to Chinese using openpyxl. The Chinese translation is placed directly below the original English text in the same cell, separated by a newline — no new rows or columns are inserted. Original formatting (merged cells, fonts, colors, images) is preserved.

Workflow

  1. Identify the input .xlsx file path from the user.
  2. Run scripts/translate.py from the shell.
  3. Deliver the output file to the user as an attachment.

Running the Script

python3.11 /home/ubuntu/skills/excel-translator/scripts/translate.py "/path/to/input.xlsx"

The output file is saved automatically with a _translated suffix in the same directory.

Custom output path:

python3.11 /home/ubuntu/skills/excel-translator/scripts/translate.py "/path/to/input.xlsx" -o "/path/to/output.xlsx"

Environment Variables

The script reads API credentials from environment variables. These are pre-configured in the Manus sandbox:

  • OPENAI_API_KEY — API key for the translation model.
  • OPENAI_BASE_URL — Base URL for the API endpoint (defaults to https://api.openai.com/v1).

Bundled Resources

  • scripts/translate.py — Core translation script. Scans all sheets, translates English text cells concurrently via OpenAI API, writes "English\nChinese" back into the same cell with wrap_text=True, and saves the result.