AI-generated Key Takeaways
-
This quickstart guide details how to build a Google Slides add-on using Apps Script to translate selected presentation text.
-
The add-on allows users to select text within their Google Slides presentation and translate it into various languages such as Arabic, Chinese, English, French, German, Hindi, Japanese, Portuguese, and Spanish.
-
To utilize this add-on, users need a Google Account, a web browser, and must follow setup instructions which include creating a Slides presentation, enabling Apps Script, and pasting provided code into designated script files.
-
Users can run the add-on by reloading their Slides presentation, authorizing the add-on, and selecting the text they wish to translate before clicking the "Translate" button in the add-on sidebar.
This quickstart creates a Google Slides Editor add-on that translates selected text in a presentation.
Objectives
- Set up the script.
- Run the script.
Prerequisites
To use this sample, you need the following prerequisites:
- A Google Account (Google Workspace accounts might require administrator approval).
- A web browser with access to the internet.
Set up the script
- Create a Slides presentation at slides.new.
- Click Extensions > Apps Script.
- Click Untitled project.
- Rename the Apps Script project to Translate Slides and click Rename.
- Next to the
Code.gs
file, click More > Rename. Name the filetranslate
. - Click Add a file > HTML. Name the file
sidebar
. Replace the contents of each file with the following corresponding code, then click Save
.
translate.gs
sidebar.html
Run the script
- In your Slides presentation, reload the page.
- Click Extensions > Translate Slides > Start. It might take several seconds for the add-on menu item to appear.
- When prompted, authorize the add-on.
- Again, click Extensions > Translate Slides > Start.
- Add text to your presentation and select it.
- In the add-on, click Translate to replace the selected text.