Codebreaker (Game on Google Sheets)

I discovered the game Codenames a few weeks ago through my friend Sabrina. It’s a really simple and fun word association game that has kinda caught fire among a few of my disparate friend groups here in SF. It’s a great party game for 6 or more people, that I’ve found myself playing quite a bit recently. I figured it would be nice to build an online version so we don’t have to worry about bringing the box everywhere, spills on the cards, etc.

Each team chooses a captain who will be giving clues to their teammates. A 5×5 grid of random words is created, for example:


A hidden key pattern is also created, but is shown only to the captains:


In the version I made, red and blue are the colors for the teams, gray is neutral, and orange is the instant-loss square.

The goal of the game is for the captains to give one-word associative clues to help their team identify their team’s words on the board (while trying to avoid words of all other colors) along with a number of words to be guessed. For example, if it is the red team’s turn, the captain could say “Princess for 2” in an attempt to get their team to pick Barbie and Daisy.

Their team then discusses for a reasonable amount of time and starts picking squares to check. During the discussion, the captain should not give any visual hints or reactions, but he or she should definitely be listening to where their team’s groupthink is headed. If the team reveals a square that isn’t one for their team, their turn ends immediately. Each team can pass at any time during their turn, and can guess one word more than the number their captain says (in case they passed earlier). There’re also other minor rules like restricting rhymes, proper nouns, parts of speech, etc. but I prefer to leave these as house rules.

If anything isn’t clear on the gameplay, this video is a bit long (10 min) but seems to do a decent job explaining:

Anyway, I buried the lead a bit I guess, but here’s the link to my sheet… feel free to make a copy to play (File -> Make a copy). The idea is that you connect a computer to a projector or TV, and the captains access the captain board on their phones, or a separate computer.

Everything is controlled through the “Codebreaker” menu. “Generate new board” reshuffles the words in the wordlist tab, “Generate captain board” creates a new hidden pattern, “Check selected cell” reveals the hidden color for the selected cell, and “Clear board” clears the colors from the board.

Codebreaker Menu

I used Google Sheets because everybody has access, and I’ve wanted to play around with Google Apps Script for a while. It’s actually pretty well documented, and examples were easy to find. The project overall was pretty simple and only took a few hours for me to complete, most of which was spent inefficiently, typing out 500 words into the word bank while watching movies.

EDIT: Speaking of words though, I’ve had a few friends ask me how to add/edit the word library… It’s pretty simple, just be sure to make your own copy of the spreadsheet, or anybody accessing the original will be able to mess up your game.


To edit the wordlist, just go to the wordlist tab and add words into column A. Just be sure to drag the formula from column B down to cover any words you add, just like in excel. Alternatively you can just type the function “=rand()” into column B next to any words you add. In this example, I’ve added the word Slipper, and to complete the addition process, I can just drag the bottom right corner of B500 into B501.


I don’t plan on really maintaining or further developing this because it’s pretty functional for what my friends and I need, but there’s just a couple of things I’ll try to complete sometime:

    – Randomize red/blue team starts. Right now, the red team always goes first (and has an extra word to guess)
    – Keep track of points scored by each team
    – Make a better UI experience via having control buttons on the sheet.
    – I would like to create a better way to get the link to the captains’ phones, and maybe make it easier to not accidentally show the captain board, maybe via a password protect.
    – I could also include the instructions for how to use the sheet, but ehh I think it’s pretty self-explanatory.

Have fun!

Leave a Reply

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