Remember when I introduced the idea of cloning Google Spreadsheets with ASP.NET using Excel?
Well, it turns out to be a perfectly feasible task, and I have a working prototype too!
The idea and the implementation
The idea was to look at Microsoft Excel COM interop with ASP.NET – I had seen examples of generating spreadsheets using interop, but it seemed no one had actually done anything more.
Since I haven’t really done any ASP.NET stuff from the ground up, and it was mostly cobbled together to just see if it could be done, so it involved software development methodologies such as “Copy and Paste”.
There was initially a problem with talking to Excel, as the Windows version I’m using is in Finnish, and my Office 2007 is the English version. Every time I tried doing something to the spreadsheet, such as getting a value from a cell, it would throw an exception. Luckily some Googling gave me an answer to change the currently executing thread’s locale to en-US, which fixed it and let me continue.
I sadly do not have a server which can run ASP.NET, and it is not actually a very good idea to run it on a live server for real users either due to things I’ll tell you about in a bit… however, here’s a screencast I made of it, which should give you an idea:
From the screencast, you can see how it first loads the Excel spreadsheet’s current data into the grid, and then when edits are made, any changes that happen to the values in the spreadsheet are reflected in the grid as well.
So is this a Google Spreadsheets killer?
As you can see from the above, it is a feasible concept. However, it has several issues, because Excel is not a “server” type of application.
Excel is built as something that the user interacts with directly, as in a desktop application. If you typed a formula wrong, it would show you a popup and you’d close it and things like that.
If you type a formula wrong in the JS grid, it will go to Excel, which will display a popup… but it will have no one to close it. It will effectively stop the whole app with the pop: It will not reply to messages until the popup is closed, and any actions done before that will throw an exception.
In theory you could set up the server so, that it runs an application which would automatically click any popups Excel shows to close them… but I’m not sure if that would work out so well.