rosetta
Enables translation of Excel files using Claude AI while preserving formatting, formulas, and data integrity.
README
Rosetta
AI-powered Excel translation CLI. Translates Excel files while preserving formatting, formulas, and data integrity.
What it does
Rosetta translates all text in your Excel files using Claude AI, without breaking:
- Formulas and calculations
- Formatting (fonts, colors, borders)
- Merged cells and layouts
- Charts and images
- Dropdown menus
- Rich text (bold, italic within cells)
Prerequisites
You need a Claude API key from Anthropic.
- Go to console.anthropic.com
- Create an account (or sign in)
- Go to API Keys and create a new key
- Copy the key (starts with
sk-ant-...)
Note: API usage is billed by Anthropic. See anthropic.com/pricing for current rates. Translating a typical Excel file costs a few cents.
Installation
Install from PyPI:
pip install rosetta-xl
Then set your API key:
# Linux/macOS
export ANTHROPIC_API_KEY=sk-ant-your-key-here
# Windows (Command Prompt)
set ANTHROPIC_API_KEY=sk-ant-your-key-here
# Windows (PowerShell)
$env:ANTHROPIC_API_KEY="sk-ant-your-key-here"
Or create a .env file in your working directory:
ANTHROPIC_API_KEY=sk-ant-your-key-here
Usage
# Translate to French
rosetta input.xlsx -t french
# Translate to Spanish with custom output name
rosetta input.xlsx -t spanish -o translated.xlsx
# Specify source language (auto-detected by default)
rosetta input.xlsx -s english -t german
# Translate only specific sheets
rosetta input.xlsx -t french --sheets "Sheet1" --sheets "Data"
# Add context for better translations (e.g., domain-specific terms)
rosetta input.xlsx -t french -c "Medical terminology document"
Options
| Option | Short | Description |
|---|---|---|
--target-lang |
-t |
Target language (required) |
--source-lang |
-s |
Source language (auto-detect if omitted) |
--output |
-o |
Output file path (default: input_translated.xlsx) |
--sheets |
Sheets to translate (can repeat, default: all) | |
--context |
-c |
Domain context for better accuracy |
--batch-size |
-b |
Cells per API call (default: 50) |
Examples
Translate a price list to multiple languages:
rosetta prices.xlsx -t french -o prices_fr.xlsx
rosetta prices.xlsx -t german -o prices_de.xlsx
rosetta prices.xlsx -t spanish -o prices_es.xlsx
Translate a medical form with context:
rosetta patient_form.xlsx -t french -c "Medical intake form with clinical terminology"
Translate only the "Questions" sheet:
rosetta survey.xlsx -t japanese --sheets "Questions"
Troubleshooting
"ANTHROPIC_API_KEY not set"
- Make sure you've exported the key:
export ANTHROPIC_API_KEY=sk-ant-... - Or create a
.envfile with the key
"Invalid API key"
- Check that your key starts with
sk-ant- - Make sure you copied the full key from console.anthropic.com
"Rate limit exceeded"
- You've hit Anthropic's rate limits. Wait a minute and try again
- Or reduce batch size:
rosetta input.xlsx -t french -b 20
How it works
- Extracts all text cells from your Excel file
- Sends text to Claude AI for translation (in batches)
- Writes translations back, preserving all formatting
- Saves the translated file
Your original file is never modified.
Web App & API
Rosetta also includes a web application and REST API for browser-based translations.
Running the API server
# Install with uv (recommended)
uv sync
# Start the server
uv run uvicorn rosetta.api:app --reload
# Or with pip
pip install -e .
uvicorn rosetta.api:app --reload
The API runs at http://localhost:8000 by default.
Running the frontend
cd frontend
npm install
npm run dev
The frontend runs at http://localhost:5173 and connects to the API.
API Endpoints
| Endpoint | Method | Description |
|---|---|---|
/translate |
POST | Translate an Excel file (returns file) |
/translate-stream |
POST | Translate with real-time progress via SSE |
/estimate |
POST | Get cell count and cost estimate |
/sheets |
POST | List sheet names in a file |
/count |
POST | Count translatable cells |
/preview |
POST | Preview cells that will be translated |
/health |
GET | Health check |
Real-time Progress
The /translate-stream endpoint uses Server-Sent Events (SSE) to stream translation progress in real-time. The frontend automatically falls back to the standard /translate endpoint on networks that don't support SSE (e.g., corporate proxies).
MCP Integration
Rosetta includes MCP (Model Context Protocol) servers for both Claude Desktop and Claude Web.
For Claude Desktop (Local)
Add to your Claude Desktop config (~/Library/Application Support/Claude/claude_desktop_config.json):
{
"mcpServers": {
"rosetta": {
"command": "uv",
"args": ["run", "--directory", "/path/to/rosetta", "python", "-m", "rosetta.api.mcp"],
"env": {
"ANTHROPIC_API_KEY": "your-key-here"
}
}
}
}
Usage: Use local file paths for best results.
Translate ~/Downloads/report.xlsx to French
For Claude Web (Browser)
Note: Claude.ai does not yet support custom MCP servers in the browser (as of January 2026).
Current recommendation: Use the web app for browser-based translations.
See MCP_USAGE.md for detailed instructions.
Requirements
- Python 3.11+
- Anthropic API key
License
MIT
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。