13. November 2018

Spreadsheets are programs 

I’ve said it before, and I’ll say it again: Spreadsheets are programs!

Don’t believe me?

Spreadsheet sample “program” and corresponding Javascript code ↓↓↓

let B1 = 14;
let B2 = 12;
let B3 = B1 + B2;console.log("Total: ", B3);

spreadsheet-b1+b2

let A = [ 10, 13, 8, 2, 7 ];
let B = [ 13, 3, 10, 6, 2 ];
let C = [ ];for (let i=0; i<5; i++) {
 C[i] = A[i] + B[i];
}console.log(C);

sheet-a5+b5

See? Spreadsheets *are* programs. Yet instead of code that is written line by line, spreadsheets allow you to program the relationships between data elements that live in arbitrary cells. Spreadsheet programs also auto update upon every edit, and thereby give the programmer an instant visual feedback loop.

To get theoretical about it: spreadsheets are both functional and reactive ← two of the hottest coding terms of late. (I wrote a bit more about this here)

And there is more. A key idea in computer science is that of three tiered architectures:

  1. data

  2. logic

  3. presentation

The “data layer” in modern web systems typically lives in relational databases.

The “logic layer,” is often a combination of both server-side code and front-end code. The server-side code might be something like Python and the front-end code is typically JavaScript.

Finally, the “presentation layer” — what the person actually sees — is coded in HTML and CSS. Usually there is a host of other technologies involved just to get started.

Enter the spreadsheet. The power — and one of the perils — of the spreadsheet is that it shamelessly mixes the data, logic and presentation layers, like its users couldn’t care less.

Which — frankly — they don’t.

So spreadsheets in general, and Excel in particular, is by far the most used database in the world. It is also the most used programming language and UI tool in the world.

Thus, without knowing it, people that create these types of spreadsheets — and there are hundreds of millions of them in the world — are in fact “full stack” developers.

Back to the spreadsheet vs. coding comparison. The screenshot above shows a fairly typical spreadsheet. It’s a financial model with about a dozen assumptions. Now, if I wanted to recreate this relatively simple spreadsheet using regular programming tools, the logic alone might be 61 lines of non-trivial JavaScript code. Believe me, I tried it:

openspreadsheet

let budget = 10000;
let cpc = 1.0;
let vrr = 10;
let vrl = 0;
let rsr = 2.5;
let rsl = 1;
let churnrate = 10;
let churnlag = 12;
let viralperreg = 1;
let viralpersub = 2;
let price = 19;let series = {
 visitors: [ 0 ],
 organic: [ 0 ],
 paid: [ 0 ],
 registrations: [ 0 ],
 new_subscriptions: [ 0 ],
 churn: [ 0 ],
 registered_users: [ 0 ],
 subscribers: [ 0 ],
 MRR: [ 0 ]
};for (let i = 1; i<37; i++) {
 series.paid.push(
   budget / cpc
 );
 series.organic.push(
   viralperreg * series.registered_users[i - 1] +
   viralpersub * series.subscribers[i - 1]
 );
 series.visitors.push(
   series.paid[i] +
   series.organic[i]
 );
 series.registrations.push(
   series.visitors[Math.max(0, i - vrl)] *
   vrr / 100
 );
 series.new_subscriptions.push(
   series.registrations[Math.max(0, i - rsl)] *
   rsr / 100
 );
 series.churn.push(
   series.subscribers[Math.max(0, i - churnlag)] *
   churnrate / 100
 );
 series.registered_users.push(
   series.registered_users[i - 1] +
   series.registrations[i]
 );
 series.subscribers.push(
   Math.max(0,
     series.subscribers[i - 1] +
     series.new_subscriptions[i] -
     series.churn[i]
   )
 );
 series.MRR.push(
   Math.round(series.subscribers[i] * price)
 );
}

Next, if I wanted it to be presentable on the web, I would need to create a user interface (“presentation layer”) and run a web server.

In order to save edits (like a spreadsheet does naturally) I would have to beef up the “data layer” and run a database system.

All of this would easily take several hundred lines of code in about five different programming languages (e.g. SQL, Python, JavaScript, HTML and CSS).

Say I want to add a chart to visualize the data and I would have to include several different libraries and at least a couple of hundred more lines of code. So you see: spreadsheets are very productive programming environments!

Now, if only there was a way to take existing spreadsheets and easily publish them as beautiful reports, data dashboards or interactive web applications.

Wait. We at GRID are building exactly that!

This article has also been published on Medium.

More blog posts

23. March 2021

GRID launches empowering spreadsheet-to-web software 

It’s launch time, and we couldn’t be more thrilled. Something special happens when a team this passionate unites behind a...

21. October 2017

3 things you don’t understand about spreadsheets (Part 1)

The world has a love/hate relationship with spreadsheets.

27. October 2017

3 things you don’t understand about spreadsheets (Part 2)

This is part 2 of 3 in a series of posts about the nature and history of spreadsheets.

28. August 2018

Excel vs. Google Sheets usage — nature and numbers

One of the most common questions I get is if Excel is still important, implying that “everybody” must be using...

16. October 2018

The 3 types of spreadsheets

We have been taking quite a deep dive into the world of spreadsheets lately. We have analyzed tens of thousands of...

03. November 2017

3 things you don’t understand about spreadsheets (part 3)

This is the third and final part of a series of blog posts on the origin and nature of sspreadsheets.

14. December 2018

The 20 Best Spreadsheet Quotes

In GRID’s deep dive into the world of spreadsheets, we’ve come across a lot of insightful, witty and sometimes somewhat distressing quotes....

08. February 2019

Excel — a Domain Specific Language for Finance?

One of my biggest inspirations when doing background research before starting GRID was Felienne Hermans. I met Felienne first at Strata in London...

07. May 2019

The Case for Modern Productivity Tools

Several startups are realizing the power of spreadsheets and the spreadsheet “metaphor” as an end-user development approach: A way to...