Question-and-Answer Resource for the Building Energy Modeling Community
Get started with the Help page
Ask Your Question

Using roo gem to extract info for OpenStudio measure

asked 2020-09-22 08:20:59 -0600

Saif's avatar

updated 2020-09-22 11:02:14 -0600

I am trying to extract some information from excel file to use it in OpenStudio measure using roo gem. I tested the code as a standalone ruby file and it was working fine, but when I put it in OpenStudio measure I got this error message “cannot load such file -- roo”.I am not that savvy in programing so I am not sure if I am doing something wrong, also is there another way to extract information form excel file? Below a snip from the code I am trying to use

require 'roo'   

# open system input file
def Bldg.extract_bldg_hvac
    hvac_xlsx ='./input_systems.xlsx')

Thank you,

edit retag flag offensive close merge delete


roo is not part of the list of pre-installed (well, embedded) gems that ships with the Openstudio CLI.

Julien Marrec's avatar Julien Marrec  ( 2020-09-22 09:07:44 -0600 )edit

thank you Julien, is there a way to include it ?

Saif's avatar Saif  ( 2020-09-22 09:27:19 -0600 )edit

2 Answers

Sort by » oldest newest most voted

answered 2020-09-22 10:12:03 -0600

I would suggest saving the Excel file as a comma separated value file (CSV) or tab separated value file (TSV). You can then use the CSV class that ships with ruby to extract the information.

This will work perfectly with OpenStudio and does not require a new gem (roo, which requires nokogiri, a complex gem that must be compiled for anyone to use and is incompatible with OpenStudio), thus allowing your measure to more easily be used by others.

edit flag offensive delete link more

answered 2020-09-22 17:30:22 -0600

updated 2020-09-22 17:44:59 -0600

If you're intent on using Excel (and Windows), you can use the win32ole class (included in the standard Ruby installation) to read and write data from a workbook.


Edit: Turns out the CLI doesn't include win32ole either.

edit flag offensive delete link more



Are you sure? I think win32ole is excluded from the ruby provided with the OpenStudio CLI: openstudio -e "require 'win32ole'" gives an error.

shorowit's avatar shorowit  ( 2020-09-22 17:36:06 -0600 )edit

@shorowit No, I wasn't sure. Perhaps not, then. I just use it with system Ruby.

ericringold's avatar ericringold  ( 2020-09-22 17:38:38 -0600 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower


Asked: 2020-09-22 08:20:59 -0600

Seen: 315 times

Last updated: Sep 22 '20