Repo provides a Python script for translating the contents of Excel files between different languages.
Finding the right tool to translate files with numerical data can be surprisingly tricky. Often, built-in Excel features, macros, or online resources don’t quite cut it, especially when translating specific language pairs.
I ran into this problem myself while trying to translate files from Russian to Ukrainian for business documentation. Existing tools just weren't up to the task. So, I created a custom tool to handle this specific translation need, making it easier to convert data files accurately and meet business requirements.
- Automatic File Detection: The script automatically detects the first Excel file in the current directory.
- Language Translation: Translates text from one language to another using the
translate
library. - Progress Indicator: Displays a progress indicator while processing the translation.
- Output Naming: Saves the translated file with a prefix indicating the target language.
To install the required libraries, run:
python 3.11.9
pip install translate pandas
- Download the translate_excel.py file. Place it along with aimed .xlsx file in the same folder. Open a terminal and navigate to this folder.
- Run the translation script from the command line as follows:
python translate_excel.py [from_lang] [to_lang]
from_lang
: The language code of the source language (e.g.,"ru"
for Russian).to_lang
: The language code of the target language (e.g.,"uk"
for Ukrainian).
Look into - catalogue.txt
To translate an Excel file from Russian to Ukrainian:
python translate_excel.py ru uk
IMPORTANT: This script will process the first .xlsx file it finds in the directory. Ensure that only one excel file you want to translate is in the folder!
This project is licensed under the MIT License - see the MIT.md file for details.