Auto-translate a deck into another language
Localise all text boxes in a Northwind deck in place — German, Spanish, or any LanguageApp target.
Published Aug 17, 2025
When Northwind pitches to a client abroad, the deck has to be in their language — and the slow way is to copy each slide, paste every line into a translation tool, and paste the result back, box by box, for forty slides. It takes an afternoon and it is easy to miss a stray text box.
This script does the whole pass in seconds. Point it at a deck, give it a source
and target language, and it walks every shape on every slide, translating the
text in place with Google’s built-in LanguageApp. It is best run on a copy
of the deck, so you keep the original and get a localised version alongside it.
What you’ll need
- The ID of the Slides deck to translate — copy the original first if you want to keep an English version.
- A source and target language as two-letter codes:
en,de,es,fr,ja, and so on. - Edit access to the deck from the account running the script.
The script
/**
* Translates every non-empty text box in a deck in place.
*
* @param {string} deckId The ID of the Slides deck to translate.
* @param {string} sourceLang Two-letter source language code, e.g. 'en'.
* @param {string} targetLang Two-letter target language code, e.g. 'de'.
*/
function translateDeck(deckId, sourceLang, targetLang) {
const deck = SlidesApp.openById(deckId);
const slides = deck.getSlides();
if (!slides.length) {
Logger.log('Deck has no slides — nothing to translate.');
return;
}
let boxes = 0;
// 1. Walk every slide in the deck.
for (const slide of slides) {
// 2. Walk every shape on the slide.
for (const shape of slide.getShapes()) {
const textRange = shape.getText();
const text = textRange.asString();
// 3. Skip shapes with no text (images, lines, empty boxes).
if (!text.trim()) continue;
// 4. Translate the text and write it straight back into the shape.
textRange.setText(
LanguageApp.translate(text, sourceLang, targetLang)
);
boxes++;
}
}
Logger.log('Translated ' + boxes + ' text box(es) into ' + targetLang + '.');
}
/**
* Convenience wrapper: translates a fixed deck from English to German.
* Edit the IDs and codes, or call translateDeck directly.
*/
function translateNorthwindDeck() {
translateDeck('1abcDeckId', 'en', 'de');
}
How it works
translateDeckopens the deck by ID and gets its slides. A short guard stops the run if the deck is empty.- It loops over every slide, then over every shape on that slide — titles, body placeholders, free-floating text boxes, the lot.
- For each shape it reads the text as a string and skips anything blank, so images, lines and empty boxes are passed over without an API call.
- It calls
LanguageApp.translatewith the source and target codes and writes the result straight back into the same text range withsetText— the translation lands exactly where the original text was. translateNorthwindDeckis a thin wrapper so you can run the job from the editor without passing arguments; edit its IDs and language codes to suit.
Example run
Run translateDeck('1abcDeckId', 'en', 'de') on a deck whose title slide reads:
Northwind Studio Brand strategy and design
After the run the same slide, same layout, reads:
Northwind Studio Markenstrategie und Design
Every text box across every slide is converted in one pass — the proper noun “Northwind Studio” is left effectively unchanged, the descriptive line is in German.
Run it
This is an on-demand job — you translate a deck when you need it:
- Make a copy of the deck so the English original is preserved.
- Put the copy’s ID into
translateNorthwindDeck(or calltranslateDeckdirectly) and set the language codes. - In the Apps Script editor, select the function and click Run.
- Approve the authorisation prompt the first time, then open the deck to check the result.
Watch out for
setTextreplaces the whole text range, so mixed formatting inside a box — one bold word, a coloured phrase — is flattened to the box’s default style. To keep inline styling, walk each text element and translate its runs individually instead.- It always runs on the deck you give it. Translate a copy, or the English original is overwritten with no undo beyond Slides’ version history.
LanguageAppis machine translation. It is fine for internal drafts and quick turnarounds, but a client-facing pitch deserves a native-speaker review before it goes out.- Tables, charts and SmartArt-style grouped shapes may not expose their text via
getShapes()at the top level. Text inside grouped shapes needs the group unpacked first; chart and table text may not be reached at all. - A large deck means many translation calls.
LanguageAppis subject to daily quotas — a single deck is well within them, but translating dozens in a loop is not.
Related
Extract all deck text into a sheet
Pull text out of every slide for review, translation, or copy-editing.
Updated Jan 4, 2026
Generate sales-enablement decks per segment
Tailor Northwind's messaging slides by audience segment — fintech, healthcare, retail.
Updated Dec 28, 2025
Insert chapter divider slides from an outline
Add section-break slides between chapters in a Northwind deck.
Updated Dec 21, 2025
Build a deck accessibility checker
Flag missing alt text, low contrast, and tiny fonts across a Northwind deck.
Updated Dec 14, 2025
Drive menu and price-list signage from a Sheet
Generate display slides for a Northwind venue — menus or price lists driven by a Sheet.
Updated Dec 7, 2025