Tips for connecting Excel files to SketchUp

I am looking for advice from experienced programmers on how to connect excel files to sketchup.
I am currently collecting information about this process. I’ve looked at the threads here, on the forum, and from other sources, but for the most part they’re sketchy and reflect some specific problems and solutions.
For now, I would like to get an opinion on how and in what way it is better to do it, so that I can try to implement it later. Can this be implemented without additional hemes? Or maybe someone already has working libraries that can be plugged into this process. I’m new to programming, so installing and connecting gems seems very complicated to me.
The main task is to connect the excel file as a database. Then, based on the data collected from the model, I want to retrieve additional related information (for example, by the ID code searched in the database file) from that database and populate the table in the dialog box with the relevant data from the model and from the database data (Excel file). For example, in a model I look for an attribute that contains an ID, the number of groups in the model, then the code looks up that ID in the database and gets other information related to that ID (manufacturer, manufacturer ID, seller, price…) and passes it to the table in the dialog box.
I will be very grateful for your advice.

1 Like

…I never did it too! So my first tip:
JavaScript import excel to html


Also a novice, so sorry no advice. Very interested in this thread though, great question @KScher!

Thank you. Will have to investigate)
I’ve been researching some VBO and Curic plugins and noticed that they use this exact approach.

There are two ways I know of, depending upon whether Excel is actually installed on a system.

If it is, you can use the Windows only Ruby WIN32OLE class to connect to an Excel application instance and manipulate a Workbook.

If it is not and the Excel file is an XML based .xlsx file, you can use the REXML Ruby (bundled gem) library to parse the file.

What is a “heme” ?

So, then you choose the most difficult project as your first project ?
This is like jumping from kindergarten to 4th year college level.

I suggest you begin with simple projects and slowly build experience.

The REXML gem is distributed with SketchUp as a bundled gem with SketchUp 2024. So it need not be installed, just require it.

At one time it was part of the Standard Library, so it came with older version of Ruby in the 2.x trunk. It might have been removed at some point and might need to be installed …

Gem.install "rexml"

I just tried it in SU2023 but got a gem build error. This is weird because I thought the doc said it was a pure Ruby gem.

FYI, Excel is not really a database application, but it can serve up simple tables of data. Insisting upon using Excel or Excel files is actually complicating the project.

Meaning that simple data tables can be kept in many file formats, many of which can be read and written natively by many programming languages, including Ruby.

Examples are CSV and TAB text files. Or more up to date, JSON text files. SketchUp’s own preferences files are JSON format since the 2018 release. JSON data files can be parsed directly into Ruby Hash objects.


The current rexml gem has the following. Notice the "">= 3.0.9" in the highlighted line.

But, the current rexml master (which contains unreleased changes/commits), shows:

So, it was decided that with a little extra code, the dependency on a more recent strscan version could be removed.

strscan is an extension gem, so it requires compile/build tools. That’s what stopped your install…

Off topic

Things like are this are part of the reason I encourage Trimble to get current on its embedded Ruby versions.

I could go on, but treating Ruby as if we’re still on Ruby 2.2 just isn’t a correct viewpoint. There have been two main changes:

  1. The ‘free’ CI services provided for OSS have drastically changed.

  2. More companies have realized that allowing/paying their staff to contribute to OSS is beneficial, so there’s a larger base of qualified contributors.


I’ve also had good luck with WIN32OLE, with the huge caveats Dan mentioned: Windows only, and Excel must be installed. It actually drives Excel like remote control. Pretty cool.