Blog Post

Another reason you should learn to code: Python for Excel

Anyone who has used Microsoft Excel(s msft) since 1993 has likely dabbled at least once with VBA, or Visual Basic for Applications, scripting: That’s the year Excel 5.0 arrived with VBA support. The feature allows users to create automated tasks and functions in the spreadsheet application, extending the software’s potential.

Now, a pair of MIT students have created an plug-in alternative to VBA called IronSpread, which uses the cross-platform Python scripting language.

As I watched the video demo of IronSpread, I couldn’t help but be reminded of the “Should you learn to code?” meme a few weeks back. IronSpread is a perfect example of why you should, if you have the desire.

You can see the benefits here immediately through the video demonstrations: Comparable Python scripts contain about one-quarter the code of a VBA script. Obviously you have to know what you’re doing in Python, but it seems to me as if you could save quite a bit of time with it and generate results faster. The folks behind IronSpread — Ben Lerner (’12) and Victor Jakubiuk (’13) give you a head start with a nice simple introduction on some relevant Python basics.

I’m glad I stumbled on to this project because regardless of what others think of who should — or shouldn’t –learn to code, I chose to do so on my own last year and I picked Python as the vehicle to learn. If you’re interested, you can take advantage of the free MIT course on Python at the MIT OpenCourseWare site. Or you can dive right in and download the Excel plug-in at IronSpread.

Ultimately, I understand that a true computer programmer — one that codes for a living — is likely far more talented that someone like myself, who will build small, relatively simple apps on the side. But as we move to the “Internet of Things”, where different physical and software objects are all connected and will need to speak to each other, I think it’s a good idea to learn even the most basic of coding or scripting skills. Even for Excel.

10 Responses to “Another reason you should learn to code: Python for Excel”

  1. Being talented for something has nothing to do with whether you do it for a living. Skill, however, is something you only acquire with a lot of practice. And you only get that practice if you either have to do it a lot or like it so much you do it even more. Even so, there are a lot of people coding for a living that neither are neither very talented nor manage to advance much beyond the minimum to get paid. If you’re truly passionate about it, you’ll get further. And with talent, much further.

    Then again, if you’re really interested in large-scale number crunching, and vba doesn’t cut it, then excel likely won’t cut it either. There are much better solutions available for that, from plain python to numeric software, some of which also interfaces with python.

  2. gerardbyrne

    Ubersmart by the guys who designed this. Ruby would be better using blocks and iterators to “loop over” tables within spreadsheet. Auto-generating an ActiveModel object for a table to be able to reference columns by name would be nice.

    But.. the last thing on earth we should be doing is to actually encourage MORE software development within spreadsheets. It is the support nightmare #1 and is non-integratable and non-testable (well, kinda).

    Love the concept though.

    • ☕ J. B. Rainsberger

      It seems to me that if we build this stuff in Python, then we can easily test or test-drive it, then just plug it in to Excel as a library. Alternatively, we can start hacking it in Excel, then extract reusable bits to plain Python and test them thoroughly.

      Many people won’t, but not because they can’t.

  3. Roland

    OpenOffice has supported this for quite a while. It supports the following: 1. LibreOffice Basic
    2. JavaScript 3. BeanShell 4. Python, as well as other high-level languages.