Design a Spreadsheet UI like Google Sheets
Problem statement
Design a spreadsheet UI with two-axis virtualization, range selection, formulas, clipboard commands, sparse cell storage, recalculation, and autosave.
Asked In
Key Challenges
- ·Two-axis virtualization for a large editable grid
- ·Selection ranges, fill handle, clipboard, and keyboard navigation
- ·Formula dependency recalculation without freezing editing
- ·Cell edit modes, formatting, undo, and autosave
- ·Accessible grid semantics for a dense keyboard-first UI
2-Minute Answer — High-Level TL;DR
Read this before your interview
HLD Interview Focus
I would store a sparse workbook model and render a virtualized sheet viewport with frozen headers, selection overlays, an active-cell editor, and formula bar. Navigation and range selection run through a grid controller so keyboard, pointer, paste, drag fill, and undo produce the same edit commands. Only visible cells render; a worker or calculation engine evaluates formula dependency changes and returns patches without blocking typing. Cell edits apply locally first, autosave in versioned batches, and show conflict or recalculation status. The hard parts are two-dimensional virtualization, precise selection behavior, formula dependencies, clipboard formats, merged or resized cells, and screen-reader semantics for a very dense grid.
My Approach: Building the Solution
How to think about this problem
I'll start from a 10k×200 sheet with a SUM spill — then design sparse cells, viewport windowing, and async recalc.
Why This Approach?
Most candidates render a giant table of inputs. Strong answers build a grid engine: sparse storage, two-axis virtualization, selection model, and a formula worker that never blocks typing.
Treat the sheet like a viewport over a sparse matrix, with one active editor moving across cells.
Requirements: What Makes a Great Solution?
Clarify scope before designing anything
Requirements Exploration Questions
Ask your interviewer these questions to refine requirements
What workbook features are in scope?
- ·Single sheet vs workbook tabs
- ·Values, formulas, formatting, comments
- ·Merged cells, frozen panes, filters
How large is the grid?
- ·Rows and columns
- ·Sparse vs dense data
- ·Server-backed sheets vs local workbook
Which interactions are required?
- ·Cell edit, range selection, copy/paste
- ·Fill handle, resize, undo/redo
- ·Keyboard shortcuts
Where are formulas evaluated?
- ·Client formula engine
- ·Server calculation
- ·External data or volatile functions
What collaboration or durability level?
- ·Autosave
- ·Offline edits
- ·Multi-user presence as follow-up
Functional Requirements
Must Have — MVP
- ✓Virtualized row and column viewport with headers
- ✓Active cell and range selection model
- ✓Cell editor and formula bar
- ✓Copy, paste, fill, formatting, undo, and redo
- ✓Formula recalculation and visible error states
- ✓Autosave, loading, accessibility, and keyboard navigation
Advanced (If Time Permits)
- +Frozen panes and merged cells
- +Charts, filters, and conditional formatting
- +Worker-backed formula engine
- +Collaborative edits and presence
Non-Functional Requirements
Performance Targets
- ·Scrolling huge grids keeps cell DOM bounded
- ·Typing in active cell stays responsive
- ·Formula recompute does not block input
- ·Selection overlay avoids rerendering every cell
Reliability & Consistency
- ·Command batches are undoable and retryable
- ·Formula errors are explicit and stable
- ·Clipboard import preserves intended shape or reports mismatch
- ·Autosave conflict identifies affected range
Accessibility & Input Support
- ·Keyboard-first flows with visible focus and predictable tab order
- ·Screen-reader announcements for async changes using aria-live where appropriate
- ·Reduced-motion alternatives for animated transitions
- ·Pointer, touch, and keyboard parity for every core action
Security & Privacy
- ·Escape formula display and imported CSV text
- ·Guard against CSV injection on export boundaries
- ·Do not run arbitrary formula extensions in the UI thread
Observability
- ·Track Core Web Vitals plus domain-specific interaction latency
- ·Measure API error rate, retry rate, stale-cache usage, and client exceptions
- ·Emit structured events for critical user journeys and abandoned flows
The full solution is part of HelloFrontend Pro
The question above is free to read in full. Upgrade to unlock the interactive workspace and the senior-level walkthrough that go with it.
- Full RADIO-framework walkthrough with architecture diagrams
- Data model, API design, and rendering strategy trade-offs
- Performance, accessibility, and offline sections plus a model answer
Already a member? Log in to open the workspace.