When did you last feel you found a secret weapon to boost your productivity? For me, it was this week when I discovered you could call the Deepl Pro API inside a Google Spreadsheet.
Switzerland is not your typical country as we handle a lot of languages in our day to day. Switching from English to French is already a challenge; we know that for French people. You add Italian and German and are on for a substantial loss of productivity.
Now, here is a simple tutorial on how I made it:
- In your Google Sheet, from the “Extensions” menu, select “Apps Script” to open the Apps Script editor.
- Create a script file named
DeepL.gsand copy the contents of the DeepL.gs file in this repo into it.
- Modify line 26 of the script to include your DeepL Authentication Key. This line looks like
const authKey = "..";, and it comes after the license text.
- Close the Apps Script editor and return to your sheet.
This guide walks you through the setup using a new, blank Google Sheet. But you can also use the add-on with an existing Sheet (including if that Sheet already has App Scripts). In the case of a sheet that already has App Scripts, you’d need to add a new Apps Script file (e.g., “DeepL.gs”) and add the code provided below.
Create a new Google Sheet. In the top toolbar, click “Extensions” then “Apps Script”.
A new Apps Script tab will open. It should look something like this:
Delete the function myFunction()… placeholder code so that this “Code.gs” section on the Apps Script tab is empty.
Replace the “Code.gs” section in the Apps Script tab with the contents of the “DeepL.gs” file in this git repository. Click here to get the raw contents from GitHub, and copy and paste the contents into the Apps Script tab.
Go to deepl.com and sign in to your DeepL API account
If you don’t yet have a DeepL API account, create one here.
Go to the Account tab in your API account
Scroll down to find your authentication key.
Copy your authentication key.
Go back to the Apps Script tab. Paste your DeepL API authentication key in between the quotation marks (” “) on line 26 of the Code.gs file.
Line 26 of the Code.gs file should look something like this:
const authKey = "ab7be987-af47-8776-815f-0fad93fe87b8:fx"; // Replace with your authentication key
Rename your Apps Script project
Click on the “Untitled project” title and give the project a new name. You can use any name you like.
Click on the “Save” icon in the Apps Script toolbar
You can now close the Apps Script tab and navigate back to the Sheet you created at the start of setup. Let’s get translating!
The example includes two functions:
Each function has “pop-up” documentation you’ll see when you start typing it into a cell in your sheet.
Note that you cannot create glossaries using this Google Sheets add-on. You can only reference glossary IDs of glossaries that were already created with the DeepL API.
In addition, here are some examples that might help you get started.
=DeepLTranslate("Bonjour!") “Hello!” (or equivalent in your system language) DeepLTranslate("Guten Tag", "auto", "FR") “Bonjour” =DeepLTranslate("Hello", "en", "de", "61a74456-b47c-48a2-8271-bbfd5e8152af") “Moin” (translating using a glossary) =DeepLUsage() “106691 of 500000 characters used.” =DeepLUsage("count") 106691
Type some sample source text into cells A1 and A2.
I’ll use the following sentences:
- “The weather sure is nice today.”
- “I wonder if it’s supposed to rain later this week.”
In cell B1, type
=DeepLTranslate( to start using the DeepL function we created.
We’ll use the following parameters:
input: A1 (cell A1—but you can also type in your own text)
source_lang: “auto” (DeepL will auto-detect the source language)
target_lang: “DE” (German—or feel free to select a 2-letter language code of your choice from the target_lang section on this page)
glossary_id: We’ll skip this parameter, as we aren’t using a glossary in this example.
The resulting function call will look like this:
=DeepLTranslate(A1, "auto", "DE")
Press enter to run the function.
Success! Cell A1 was translated into German.
To translate our second cell of source text, you can copy cell B1 and paste it into B2.
Congrats! You’ve reached the end of this tutorial. Happy translating!