A Virtual Machine, In Google Sheets

In the last couple of decades we have become used to the browser taking over so many of the desktop functions for which we used to rely on stand-alone software. Email clients, calendars, office suites and much more can now be found in the cloud, courtesy of the usual technology companies.

Sometimes these cloud-based alternatives to desktop software can be a little sketchy, but often they have features that might surprise you as they edge towards parity with the packages they seek to replace. Google Docs, for instance has a full-featured built-in scripting language called Apps Script, that gives your full control of a document or spreadsheet with the help of a bit of Javascript. When [Brian Steffens] saw this it piqued his interest, so of course he had to in his words “do something weird with it”. The result of his efforts is the Google Sheets Virtual Machine, a virtual computer in software using spreadsheet cells as memory, stack, and registers.

With only a 100-cell memory and dependent entirely upon the processing power available to the host browser, this machine is not likely to set the world on fire. He gives full instruction set details, there are a couple of demo programs, a Fibronacci sequence generator and a factorial generator, but its general lack of power is not really the point. Instead its value lies in an elegant demonstration for its own sake that a virtual computer can be built in the unlikeliest of places, and for those interested enough to peer into its code, some idea how that might be achieved.

[via Hacker News]

32 thoughts on “A Virtual Machine, In Google Sheets

  1. One problem I’ve seen with browser-based instead of native is during the process of loading, graphical elements jumping around til everything’s loaded. Native, all of it is up. Other is the plainness of most interfaces compared to native.

    1. This is where Micro$0ft really nails it with Office 365. All of the functionality of the M$ work suite in the cloud running smoothly.
      I really liked Google Apps being the first to have cloud based text editing, spreadsheets, etc however they do not have as much functionality as does the M$ version of those tools in the cloud.

      1. This is the only site I frequent where people still unironically replace the S in Microsoft with a dollar sign. It’s like being in high school again.

  2. Thanks (not) for another ginormous gif. Might I recommend consuming some portion of a jar of the peanut butter it’s named after, and then replacing the image with either something static or a *.webm?

        1. My main box right now is a Lenovo T420 laptop, actually. For the record, I actually /do/ have a IIgs, with a ridiculous pile of hardware to go alongside — but I have zero software to run on it. I also have a Tandy CoCo Model II, a Tandy MC-10, and a PSION Organizer II handheld… I wish I still had the C64c setup I got rid of c.2010 because “I wasn’t using it” — I should’ve started using it again, not dumped it on Fleabay! One of the few regrets I have in life.

          …just to be overly thorough…

          Secondary boxen are a custom keyboard system with an i3-3220M in a weird industrial mobo (Aaeon GENE-QM77) and a Dell AT101W bolted overhead, and a homemade laptop (a complete rebuild, third time ’round IIRC, of the Pi one that [HaD] kindly featured a while back) that features a WinTel W8 as its primary guts (Z3735F, 2gb RAM, 32gb eMMC “SSD”).

          Tertiary boxen would be an ASUS 1005HA netbook, a Dell e4310 that is my graphics box (I love you dearly, Corel, but I do so wish you’d kiss ‘n’ make up with Linux) and an HP Mini 5102 that I finally get to test my TL866C programmer with — its previous owner gave it a BIOS password that won’t leave town, and that’s one of the models where the two ways of clearing an unknown BIOS-access password are replacing the chip (or reprogramming it with an actual programmer) or replacing the motherboard, chip and all…

          Everything listed (except the old gear) runs Linux Mint, except the Dell (which runs Win7 because CorelDRAW) and the homebrew laptop, which does better on Xubuntu — Mint has issues with installing to an otherwise 64bit system that has a 32bit UEFI… oy. I vote that whoever made THAT decision, goes to the Special Hell. (…and I’m not even all that religious!)

          More on topic… I didn’t actually check the size of the GIF, just assumed that animated_GIF=big_file, which /usually/ is true, this being the exception that proves the rule.

          I still think a static image — JPEG or GIF — or a set thereof, would’ve been better… not that my opinion actually matters in this. I know you folks aren’t going to do anything different. (Not that that will make me any quieter!)

          1. Ah, you have me remembering the ole days when some “they” claimed that the only way to clear an unknown AMI bios password was to replace the chip. Pascal ignored them.

    1. I’m not a fan of moving GIFs for the same reason as you, size. So you rarely see them from me. But this one at a shade over 50k is in fact smaller than most static Hackaday featured images, so I felt it would be appropriate.

  3. The Javascript API is fantastic for embedding Excel sheets into webpages or other displays (Xibo is nice). You can programmatically specify sheets from an Excel file, only certain cells, select what cell is selected on load, etc Even allow end users to non permanently edit and use the sheet, so perform calculations based on the formulas you build into the sheet. Of course so much more is possible as seen here, but it has been crazy useful to transparently propagate changes that non-technical users make to files to embedded html/web pages. No need to ftp the files or anything of that nature, they edit and save their, and it is immediately live.

  4. For quite some time I have been using JavaScript in a browser to write simple applications for personal use especially when there is complex math processing and a complex rendered output. A modern browser provides a very capable environment to code in.

    Just the other day I was working on an embedded micro-controller project that integrated WiFi. It is only a low MIPs micro but it had no problem spitting out long stringy code to a browser. The end result is that the browser is supplying the MIPs for complex tasks and the results are then passed back to the low MIPs micro. It’s a very effective system that you wouldn’t expect to be functional with such a small micro-controller.

    Of course I am not “Robinson Crusoe” here but I was quite surprised with the capabilities of the net result.

    I wonder why I don’t see more of this sort of setup. When I do see something similar it’s and app running on a smart phone rather than a browser.

    I am guessing the reason is that your average C or embedded programmer doesn’t venture into HTTP/HTML/JavaScript land which seems odd as there are even JavaScript based APIs that run on some embedded devices ???

    HTTP is a very very simple stringy protocol. HTML can be simple as you only need a small number of tags for a simple interface and you can get bold later to make it “pretty”. JavaScript is much simpler today then years ago when it was so browser dependent.

    I often jest that my JavaScript is guaranteed to break in every browser except the one I used to develop the code but in reality you can stick to code primitives that are cross-browser compatible or use a cross-browser framework (library) that someone else has written.

  5. This is the only site I frequent where people still unironically replace the S in Microsoft with a dollar sign.
    I am guessing the reason is that your average C or embedded programmer doesn’t venture into HTTP/HTML/JavaScript land which seems odd as there are even JavaScript based APIs that run on some embedded devices ?

  6. This is the only site I frequent where people still unironically replace the S in Microsoft with a dollar sign.
    I am guessing the reason is that your average C or embedded programmer doesn’t venture into HTTP/HTML/JavaScript land which seems odd as there are even JavaScript based APIs that run on some embedded devices ?

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s