Skip to the guide

Design a spreadsheet (like Google Sheets)

AdvancedCase study11 pages

The interviewer asks you to design the classes behind a spreadsheet, where a cell holds a number or a formula that reads other cells. Picture a handwritten bill at a small restaurant, where some lines hold a price and others a rule, such as "tax: a tenth of the subtotal". When a price is corrected, the cashier rewrites each line that reads it, the total last, and keeps the old figure in the margin so she can go back. She refuses "tip: a fifth of the total", because the total includes the tip. In code, each line is a cell, a rule is a formula, the cashier is Sheet, and the margin note is a CellEdit.

It is also asked as "design Excel", and the closest other case study is the in-memory file system, another tree of parts that answer one question. Interviewers like it because a change must reach every cell that reads it, once each and in the right order.

Below is a full 45-minute round on the LLD framework. At each Guess before you read on, stop and answer first. The full runnable project is a download in Java, JavaScript and Python.

Run the full project

This design as a project you can run, with its tests and a demo. You only need Java 21, Node 24 or Python 3.13. The README says how to run it.

Step 1 · Clarify the requirements and cut the scope

Minutes 0–5 · How this step works

Interviewer: Design a spreadsheet.

You: What can a cell hold?

Interviewer: A number, or a formula that starts with "=". Text and formatting are out.

You: What can a formula use?

Interviewer: Numbers, cells such as A1, plus, minus, times, divide and brackets, and SUM over a range such as A1:A3.

You: How big is the sheet?

Interviewer: Columns A to Z and rows 1 to 1,000.

You: What if a formula reads itself, directly or through other cells?

Interviewer: Refuse the edit, and change nothing.

You: Is there undo, and what does a division by zero show?

Interviewer: Undo and redo, yes. A division by zero shows #DIV/0!, and so does every cell that reads it.