How to Create a Word Scramble in Google Sheets
Learn how to create a word scramble in Google Sheets using the Fisher Yates shuffle method with Apps Script. This tutorial walks you through the steps to implement the scramble function and how to manage the output effectively.
We've created a word scramble in Google Sheets. We can just take the function scramble, copy it down the line, and it will scramble anything in this B column here. How do we do this and how can you use this? We're going to go up to extensions, Apps Script . That's going to open this and we have done something called the Fisher Yates shuffle. You can copy this Apps Script right here and I'll walk through it. First, we're going to take The letters in the word, and we're going to split every single letter out into its own entity into an array, and then we're going to run it through what's called the Fisher Yates shuffle, which just takes a finite amount of time. Number of items and shuffles them up in using this math dot random. And then we're just going to join it all together and return it. That's the scramble part. But let me show you some interesting stuff about Apps Script that we can do. We can add up here a comment called at custom function .
We're going to save this. when we click equals, scramble, it shows up. And it asks us to add a word here and we can just select this word. Word, and it will scramble it. The issue with this function though is that every few minutes it will run again. So what you have to do is Command C and Shift Command V so that we paste values . Or, select everything, edit, Copy, and then Edit, Paste Special , Values Only. And now we have just the scrambled letters.