Design Real-Time Formula Recalculation for Shared Google Sheets
Last updated: November 29, 2026
Quick Overview
Design the calculation engine for a collaborative Google Sheets workbook with millions of cells, where an edit by one collaborator triggers recalculation of dependent formulas and every collaborator sees consistent results quickly.
0
0
0 solved
Design the calculation engine for a collaborative Google Sheets workbook with millions of cells, where an edit by one collaborator triggers recalculation of dependent formulas and every collaborator sees consistent results quickly.
Sheets is a collaborative editor where the document is a computation graph, not just text. Google interviewers use this to test dependency graph maintenance, incremental recalculation, where computation runs (client or server), and how to keep many collaborators consistent with volatile and external functions.
What the Interviewer Expects
- Build and maintain a dependency graph from formulas including ranges
- Recalculate incrementally using dirty marking and topological order
- Decide where calculation runs and what is authoritative
- Handle volatile functions (NOW, RAND) and external data (IMPORTRANGE)
- Detect circular references and bound expensive recalcs
Key Topics to Cover
How to Approach This
- Start by clarifying functional and non-functional requirements with the interviewer.
- Estimate the scale: QPS, storage, bandwidth. This drives your design decisions.
- Draw a high-level architecture first, then deep dive into 1-2 critical components.
- Discuss trade-offs explicitly (e.g., consistency vs availability, SQL vs NoSQL).
- Address failure scenarios, monitoring, and how the system handles 10x traffic spikes.
Possible Follow-up Questions
- How do you represent a dependency on A:A without listing a million cells?
- What happens when two users edit inputs at the same time?
- How would you handle a recalculation that takes 30 seconds?
- How should RAND behave across collaborators?
Sharpen Your Skills on Codemia
Practice similar problems with our interactive workspace, get AI feedback, and track your progress.
Practice System Design ProblemsSample Answer
Requirements
Functional: cell edits through the collaboration (OT) layer; formulas with references, ranges, cross-sheet and cross-file references; recalc on change; consistent displayed values for all collabor...
High-Level Design
- Edit path: cell edits are operations sequenced by the document server, like Docs.
- Calc engine: shared code (compiled to run in the browser via JavaScript or WebAssembly, and on the server)...