Hack of the day: translate directly in a Google Spreadsheet using Deepl Pro API

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:


  1. In your Google Sheet, from the “Extensions” menu, select “Apps Script” to open the Apps Script editor.
  2. Create a script file named DeepL.gs and copy the contents of the DeepL.gs file in this repo into it.
  3. 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.
  4. Close the Apps Script editor and return to your sheet.

Setup tutorial

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”.

Extensions menu -> App Script button

A new Apps Script tab will open. It should look something like this:

Apps Script tab

Delete the function myFunction()… placeholder code so that this “Code.gs” section on the Apps Script tab is empty.

Deleting the placeholder code

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.

Login to DeepL API account

Go to the Account tab in your API account

DeepL Account tab

Scroll down to find your authentication key.

Copy 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.

Rename the Apps Script project

Click on the “Save” icon in the Apps Script toolbar

Save the Apps Script project

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: DeepLTranslate and DeepLUsage.

Each function has “pop-up” documentation you’ll see when you start typing it into a cell in your sheet.

Popup documentation for DeepLTranslate function
Popup documentation for DeepLUsage function

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.

    “Hello!” (or equivalent in your system language)

DeepLTranslate("Guten Tag", "auto", "FR")

=DeepLTranslate("Hello", "en", "de", "61a74456-b47c-48a2-8271-bbfd5e8152af")
    “Moin” (translating using a glossary)

    “106691 of 500000 characters used.”


Usage Tutorial

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.”
Example sentences for using DeepL plugin

In cell B1, type =DeepLTranslate( to start using the DeepL function we created.

Typing in the DeepLTranslate formula

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.

Translating the first cell

To translate our second cell of source text, you can copy cell B1 and paste it into B2.

Translating the second cell

Congrats! You’ve reached the end of this tutorial. Happy translating!

Related Tags:

Leave a Reply

Your email address will not be published. Required fields are marked *