VisiCalc
en.wikipedia.org
en.wikipedia.org
Anyway, if they managed to write a useful spreadsheet in 20kB it's even better.
The 16k/32k/48k that apple shipped was the total ram in the machine. VisiCalc had to fit there to - no swapping/overlay was employed.
26(cols)1K(rows)2(bytes) is already 52KB. They were obviously storing things more sparsely than that - I think it was 100 rows or even less (which, at 2 bytes/cell would be in line with your 5K estimate).
However, 2 bytes is not enough for floating point values, and cells could also contain text. Whatever it was, it was more complicated than the simplest array, though probably not by much.
The following articles says 27kb, and 63 columns and 254 rows limits.