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.