
Ask HN: How to build a Google Sheets/Excel? - ralston
I&#x27;m looking for resources&#x2F;info related to the fundamentals of building a type of spreadsheet-ing software (e.g., Excel, Google Docs). Can anyone link me to any resources? Not trying to build actual tool like that, just something a bit similar. I&#x27;m having trouble finding any resources related to getting started.
======
repsilat
Hi Ralston! I'm building a spreadsheet program myself at the moment (demo and
product link at [https://6gu.nz](https://6gu.nz)).

There are two major parts to a spreadsheet app, in my view:

1\. A UI to change sheet layout and formulas, and to view computed values.

2\. A "programming language"-like engine to derive computed values from the
formulas and sheet layout.

In (2) you also have to do a bit of topological sorting to make sure you
compute things in the right order, but it's not terribly tricky.

A spreadsheet is kinda like a REPL, where the "R" and "P" are the spreadsheet
UI and the "E" is the programming language part.

In Excel and Google Sheets (but not in my program) there are some fun data
structures you might use to make formulas like `SUM(A:A)` (i.e., sum the whole
column) run in a reasonable amount of time. Essentially, data structures that
take advantage of the sparsity of the grid. I don't know off-hand the best way
to go about something like that, but if you didn't want to invent anything
yourself I guess you could just throw everything into an off-the-shelf spatial
acceleration structure (an r-tree or a quadtree or something.)

There's quite a big surface area to the problem, if there's something more
specific you want to know, please ask! I can't promise to respond quickly, but
I should get back sooner or later.

~~~
ralston
The UI looks incredibly good. Is this just implemented in pure JS?

~~~
repsilat
Well, thanks. I built it with react and redux starting with the "create react
app" package. There are probably frameworks that will help a bit more, but I'm
not too familiar with the front-end world so I went with what they used at my
last job.

