Select Page

How to get Word Meaning in Google Sheets

Written by Yashasvi Sinha

October 7, 2020

TL;DR Copy-paste the code given towards the end, in the script editor of your Google Sheet, and adjust the code according to the comments written in it.

Introduction

The clouds have covered the sky, it is already drizzling outside. You decide it is the best time to read that book that you’ve always wanted to and enjoy some quality time with yourself. So, you get your coffee (or tea) ready to be enjoyed with a little solitude. You start reading, and before you get engrossed in the world that the author wants you to be in, you encounter a word whose meaning you do not know!

Even if you are familiar with the word, you can’t remember it’s exact meaning. The whole mood is spoiled, now, you have to keep your book aside, and look up the meaning on the Internet (or dictionary if you prefer) before you continue.

You open up your phone/laptop, look up the meaning, and while you are there might as well checkup some notifications/emails, etc. Wait, You look out the window. The skies have cleared up. The drizzle is nowhere to be found. Turns out, you lost track, and spent the entire time on the Internet while you were looking up the meaning.

Does this happen to you too? If only there was a way to get the meaning and store it somewhere for referring afterward. Then, you would be able to just write the word down, see what it means, and continue to be in your engrossing world.

Well, fear not as I have found a way to achieve this. Furthermore, it won’t cost you a dime apart from a few minutes of your time.

But first, let’s define what the is the problem in the conventional method of finding the meaning of a word.

The Problem: Looking up for words takes time

Ordinarily, you will maintain a notebook where you’ll write difficult words and their meanings as you encounter them. You’ll look up the meaning on the internet (or open a dictionary if you are old school), understand the meaning, and write it down in your notebook. Then repeat this process for all the words you have.

This can get really tiresome, and the more words you have, the tedious the process.

While there’s nothing wrong with this approach, it is definitely tedious.

In this era where everything is instant in nature — instant coffee, instant (or Insta) pictures, etc — the above approach isn’t. This process is fine if you are dealing with 2 words every day. However, you’ll get frustrated with repeating the process over and over as the number of words increases.

If you could just write your word, and it’s meaning gets fetched automatically, wouldn’t that be easier? Of course.

The Solution: Use Google Sheets

I wrote a small piece of code to get the meaning from the Internet in Google Sheets. It is essentially calling a 3rd party API to get the word’s meaning. Once you set it up properly by following the steps below, you’ll be able to get any word’s meaning directly into your sheet without googling it up.

How the heck it’s supposed to work?

Ignore this section if you don’t want to know what is happening behind the scenes. Although, I recommend going through it if you’ve got the time.

Google Sheets has a script editor where you can write your custom code (Google App Script) and use it in the sheet, like a normal google sheet function.

For example, you must have used the function =SUM() to calculate the sum of a given range in an excel sheet. I’ll be using a similar approach to call a function called =WORDMEANING() which is a custom function that our code exposes to fetch the meaning from the internet using a 3rd party API.

I am using the Mirriam Webster API, to fetch the meaning of the words. It is free for personal use providing up to 1000 queries per day, and that is enough for our general use case.

Overview of how word's meaning is fetched in google sheet
Overview of how word’s meaning is fetched

Essentially, when the function =WORDMEANING() is called in the sheet, it executes our code on Google’s cloud platform. It then sends the request to 3rd Party API (in this case Mirriam Webster). Then the API responds with the word’s meaning to the Google Cloud where our code is running and listening for the response. The code parses the response and sends the formatted result back to our Google Sheet.

I hope I didn’t bored you to death with that. Nevertheless, lets move on to the actual steps to be followed.

Steps to get Word Meaning in Google Sheet

The two main steps to be followed are:

  1. Create an account in the Mirriam Webster API portal and get the API Key.
  2. Use the API key in the code below to get the word meaning.

Let’s see them in detail.

Step One: Create an account in the Mirriam Webster portal and get the API Key

Go to this link and register yourself. While you are registering, choose the “Collegiate Dictionary” in “Request API key 1” and “Collegiate Thesaurus” in “Request API key 2“.

Note: You will need to verify your account through your email.

Once you log into the account, get the Collegiate Dictionary API Key listed under the “My Keys” page and copy it into your clipboard. This is the Key you will use in the second step.

Step Two: Use the API key in the code to get the word meaning

Follow the steps below:

  1. Open a blank sheet and click on ‘Script Editor’ under the ‘Tools’ menu.
script editor location in google sheets
  1. Copy-paste the code and paste it to the script editor window.
  2. Replace “YOUR_API_KEY” in the code with the API key you got from registering yourself.
  3. Now head back to your Google Sheet and use the function =WORDMEANING() as shown below.
Example usage of how to get word meaning in Google Sheets
Example usage of how to get word meaning in Google Sheets

Voila! Now all you have to do is write your word in one column and use the function in another column. See advance usage in the conclusion section.

Code to be copied in Google Sheet script editor

/**
 * Get the word meaning of a word.
 *
 * @param {String} word for which the meaning needs to fetched.
 * @return {String} meaning of the word
 */
function WORDMEANING(word) {
  
  word = encodeURI(word);
  var options = { muteHttpExceptions: true }
  
  try{
    const key = "YOUR_API_KEY" //auth key obtained from sources like Merriam Webster
    const endpoint = "https://www.dictionaryapi.com/api/v3/references/collegiate/json/" //API end point URL
    
    const url = endpoint + word + "?key=" + key //create the actual url for the 3rd Party API endpoint
    
    const response = UrlFetchApp.fetch( url, options); //make request
    
    Logger.log(response); //log it just in case
    
    //parse the response and get the word meaning out from the response accordingly based on the 3rd party format
    // I am using Merriam Webster so, I have extracted the result accordingly
    
    const responseBody = JSON.parse(response.getContentText());
    Logger.log(responseBody);
    const {shortdef} = responseBody[0]
    const result = shortdef.map(def => `"${def}"\n` ).join(' ')
    Logger.log(result)
    
    //retrun the final result string
    return result
    
  }catch(err){
    // incase any exception occurs check the console
    Logger.log(err);
    return "Some Error Occurred. Check AppScript Executions"
  }
  
}

Conclusion

Congratulations! You have successfully added this feature. Now, all you have to do is put in your difficult word in one column of the sheet and call the function =WORDMEANING() to get the meaning right in your Google Sheet.

Most importantly, this is a huge time saver when you have a lot of words. You just have to write your words, and then all their meanings can be fetched at once without ever manually searching for the meaning. Look at the example below, and be amazed!

word meaning advanced usage
Advanced usage example

Another great benefit of this method is that it will also benefit people who are preparing for competitive exams. There’s (mostly) always a section in these exams, where you are tested for your language skills. And unless you are Shashi Tharoor or have a great hold of the language, you’ll probably have a hard time understanding the meaning of the words used in those exams.

That’s all folks! I hope this helps you in saving your precious time so that you can spend it somewhere else.

Additionally, If you come across any issues, do comment out below and I’ll help you resolve it to the best of my ability.

P.S. Don’t forget to share this article with your friends. It might help them save their time like you did.

Additional Resources

If you really want to build up your vocabulary, I suggest the book, “Word Power Made Easy” by Norman Lewis. It really teaches you the art of understanding the meaning of the word by the word itself.

Affiliate Link

You May Also Like…

No Results Found

The page you requested could not be found. Try refining your search, or use the navigation above to locate the post.

5 Comments

    • Yashasvi Sinha

      Hi Jerome,

      Apologies for the (too late) reply. Coming to the link that you have sent, I looked into it and based on the returned JSON from the API, the simplest way would be to get the “meta” key instead of “shortdef” from the response.

      Under the “meta” key, you would find a “syns” key, which is short for synonyms, and use that for your use case.

      Let me know if anything else needs clearing up.

      Cheers!
      Yash.

      Reply
  1. Jerome

    Hello, thank you for the document, it is very useful.
    I am trying to do the same for synonyms.
    I did change the line “https://www.dictionaryapi.com/api/v3/references/thesaurus/json and used the thesaurus API but fir the rest I am lost.
    Would you be able to help out ?

    Reply
  2. Andrew

    Is it possible if you could provide a more comprehensive guide for the part of what to do for the “Script Editor”?

    After pasting the code into the window, the code doesn’t work.

    Sincerely,
    Andrew

    Reply
    • Yashasvi Sinha

      Hi Andrew,

      I am assuming that you have modified the code by pasting your API key from Merriam Webster into the code where it says YOUR_API_KEY.

      If yes, then it would be great if you could let me know what the issue is, a little more elaborately.

      Waiting on your response,
      Yash

      Reply

Submit a Comment

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

Archives

Join My Newsletter

Join My Newsletter

Subscribe to my newsletter and get notified of new content

Thank you for subscribing.

Share This

Share This

Share this post with your friends!