Excel Sudoku Magic
Did you know Excel can be your new favorite Sudoku playground? That’s right! Using a clever combination of formulas, Power Query, or the COPILOT function, we can dynamically generate Sudoku puzzles and solutions directly within our workbooks. In this article, we’ll explore three powerful methods that bring Sudoku to life right inside Excel. Plus, we’ll show you how to make your puzzles interactive using conditional formatting.
Video
Why Use Excel for Sudoku?
Excel isn’t just about crunching numbers or analyzing data. It’s also great for building logic-based puzzles like Sudoku. With Excel, we can:
- Automatically generate new puzzles using live data from an API
- Display puzzle and solution grids side by side
- Use conditional formatting to verify correct guesses
- Build playable Sudoku boards
Let’s methodically walk through the steps using three techniques: Formulas, Power Query, and COPILOT.
Method 1: Sudoku with Excel Formulas
NOTE: Below is the brief outline … for a more detailed walkthrough with explanations, please visit this post.
Step 1: Call the API
We’ll use the WEBSERVICE function to bring in a Sudoku puzzle from a public API. In a cell such as B5, enter:
=WEBSERVICE("https://www.youdosudoku.com/api")
This returns a string that contains both the puzzle and the solution, like this:
{"difficulty":"easy","puzzle":"004203019003001476601087000805036204760809103000002007057024000000300700020008041","solution":"574263819283591476691487325815736294762849153439152687157624938948315762326978541"}
Step 2: Extract the Puzzle
To extract just the puzzle digits, we’ll use a combination of FIND, MID, and SUBSTITUTE functions. Here’s a simplified version using LET for readability:
=LET(api,B5,
start,FIND("puzzle",api,1)+9,
string,MID(api,start,81),
layout,MID(string,SEQUENCE(9,9),1),
clean,SUBSTITUTE(layout,0,""),clean)
This populates a clean 9×9 Sudoku board without zeros.
Step 3: Display the Solution
To display the solution, just update the LET function to find the “solution” and adjust the character offset accordingly.
Step 4: Format the Grid
- Apply all borders
- Use center alignment
- Set row height to
40for a square look - Optional: Add bold thick borders every 3 cells to outline the boxes

Step 5: Refresh the Puzzle
Due to how WEBSERVICE caches, use Ctrl + Alt + F9 to force a full recalculation and pull in a new puzzle.
Method 2: Sudoku with Power Query
NOTE: Below is a brief outline … for a detailed walkthrough with explanations, visit this post.
Step 1: Get the Puzzle from the Web
- Go to Data > Get Data > From Web
- Paste the URL: https://www.youdosudoku.com/api
- Click OK to load the data into Power Query.
Step 2: Parse and Shape the Data
Use these Power Query transformations:
- Convert to Table
- Filter for the puzzle row only
- Remove unnecessary columns
- Split the puzzle into rows using Split by Number of Characters (9 characters)
- Split again into 9 individual columns (cells)
- Replace
0withnullto create blanks
Step 3: Load the Puzzle and Format
- Close & Load To: Table in worksheet
- Center align text, increase row height, and apply borders
- Build thick gridlines around 3×3 squares as before
Step 4: Load the Solution
Repeat the steps above for the solution row from the same data source and apply the same formatting.
Step 5: Refreshing
To generate a new puzzle, go to Data > Refresh All. Don’t forget to go to Table Design > Properties and uncheck “Adjust column width on refresh.”
Method 3: Sudoku with Excel Copilot
NOTE: Below is a brief outline … for a detailed walkthrough with explanations, visit this post.
Step 1: Get the Puzzle Data
Use the same =WEBSERVICE("https://www.youdosudoku.com/api") function to pull the puzzle into a cell such as B8.
Step 2: Create the Grid with Copilot
In a new cell:
=COPILOT("Create the Sudoku puzzle grid", B8)
Where B8 contains the puzzle string from the web service.
Step 3: Clean the Grid
To remove zeros:
=SUBSTITUTE(COPILOT("Create the Sudoku puzzle grid", B8), "0", "")
Step 4: Format the Puzzle
- Center alignment and row height of 40
- Apply all borders and thick borders every 3 rows/columns
Step 5: Add the Solution
=COPILOT("Create the Sudoku solution grid", B8)
And apply the same formatting using Paste > Paste Special > Formats.
Step 6: Refresh Puzzle
Use Ctrl + Alt + F9 to force a new puzzle and solution retrieval.
Bonus: Add Conditional Formatting
To show whether a guess is correct or not, apply these steps:
- Select the puzzle cell range.
- Go to Home > Conditional Formatting > New Rule
- Select Use a formula
- Enter a formula like:
=B7=SOLUTION!B7 - Apply a color to correct guesses (e.g., light blue)
- Repeat the process and change the formula to
<>for wrong guesses

This makes our Sudoku interactive and rewarding, perfect for game lovers and Excel enthusiasts alike.
Ready to sharpen your logic skills and your Excel mastery? Start building your Sudoku generator today!
Download Sample File
FAQs About Creating Sudoku in Excel
- Is the WEBSERVICE function available in all versions of Excel?
- No, it’s only available in Excel 2013 or later.
- What if I can’t use COPILOT in my version of Excel?
- The COPILOT function is rolling out gradually. Check out the Power Query method instead.
- Is it possible to play Sudoku entirely within Excel?
- Absolutely. With the Power Query method and a bit of conditional formatting, Excel can be a fully playable Sudoku platform.
- Why use Ctrl+Alt+F9 instead of F9 to refresh?
- Ctrl+Alt+F9 forces all functions, including
WEBSERVICE, to recalculate. - Can I apply custom styles to the grid?
- Yes. Use formatting tools like borders, colors, and fonts to personalize your game board.
- How does Excel know which values are correct in the puzzle?
- By comparing each cell to the corresponding one in the solution grid via formulas or conditional formatting.
- Does this require programming or VBA?
- No programming is required. All three methods use built-in Excel features.
- Can I copy and share my puzzles with friends?
- Yes. You can share the workbook, print, or take screenshots of the puzzle and send it to friends.
- What’s the best method for generating Sudoku in Excel?
- Power Query is the most dynamic and playable, while COPILOT is the easiest (if available).
Excel is not what it used to be.
You need the Excel Proficiency Roadmap now. Includes 6 steps for a successful journey, 3 things to avoid, and weekly Excel tips.
Want to learn Excel?
Our training programs start at $29 and will help you learn Excel quickly.
Is there a way to set the difficulty?
Not to my knowledge … and according to the api’s documentation, it will: Generate a random difficulty puzzle and solution.