Sending Serial Data From… Excel?

When you think about serial communications, Microsoft Excel isn’t typically the first program that springs to mind. But this spreadsheet has a rather powerful scripting language hidden away inside it, which can, with a little coding, be used to send and receive data over your serial port (Internet Archive Link, as of 2023). The scripting language is called Visual Basic for Applications (VBA), and it has been a part of Microsoft’s Office suite since 1993. Since then, it has evolved into a powerful (if sometimes frustrating) language that offers a subset of the features from Visual Basic.

It can be a useful tool. Imagine, for instance, that you are logging data from an instrument that has a serial port (or even an emulated one over USB). With a bit of VBA, you could create a spreadsheet that talks to the instrument directly, grabbing the data and processing it as required straight into the spreadsheet. It’s a handy trick that I have used myself several times, and [Maurizio] does a nice job of explaining how the code works, and how to integrate this code into Excel.

If you’re looking for other ways to leverage this Excel feature, consider watching movies at work or building a virtual machine inside of your sheets.

23 thoughts on “Sending Serial Data From… Excel?

  1. One of my first jobs was to write a VBA script in Excel to connect to a PLC (programmable logic controller) via a serial port to read in data for further analysis. That was in the late 90’s

  2. Thanks for the article, I think this is an great way to log the data coming from my Arduino.
    I’ve seen some other tools that people have written to log and graph serial data, but it’s nice being able to do it with software that’s already installed on my computer and is familiar to me (as opposed to installing python and having to figure out which command prompt I’m supposed to use to write code and which one to use to run code. Ugh).

    Don’t listen to the jerks out there, I think you guys at HaD do an awesome job!

    1. BUT you can collect your data from an embedded system and populate the spreadsheet directly. i.e. integrated. This has the added advantage of plot them *live* and not having to go the *extra step* of importing *after* collecting them.

  3. For fun and games or perhaps the odd on-off job in a strange evironment, excel is goog enough for the job, but for evrything else it is a disaster in the making. Remember everytime sombody uses excel for a production job, a puppy dies.

  4. Yeah, VBA, what a work of genius. A spreadsheet / word-processed document that can access the friggin’ disk, email people, and generally dick with your hardware. And wait, there’s more! An email function, so your word-processor can send viruses to your other dumb friends who use a screwdriver as a hammer. But no problem! Here’s a virus scanner that’s also a plasma rifle for “Halo”.

Leave a Reply

Please be kind and respectful to help make the comments section excellent. (Comment Policy)

This site uses Akismet to reduce spam. Learn how your comment data is processed.