I’m thinking of using Sketchup to do some modelling of components whose parameters are stored in Excel. I’d like to make use of Sketchup APIs to create and design Sketchup models out of Excel. Is this possible and where I can I find the references to add to my VBA environment?
Yes I did. Those are the examples, not the Ruby docs for it’s DSL.
And again the description says …
The WriteXLSX rubygem can be used to create an Excel file in the 2007+ XLSX format
There are quite a few methods defined in later versions (that are shown in the examples) that are not documented in the v0.4.4 docs. Some of the method names have changed, etc.
That old version of the docs does not show any iterators of the cell data. There are no dedicated “read” type of methods except the old version had a #value getter for the Cell class. But the newer versions do not seem to define Row and Cell classes.
This project is not being maintained well the last 2 branches and the master are way behind in commits. (Who does 80 commits without releasing a version ?) It’s behind in pull requests as well.
It’s also poorly documented and it appears that all the YARD doc comments have been removed, so it wouldn’t help to run YARD on it.
Add to this that it has a multitude of extra stuff (formatting, drawing etc.) that isn’t needed for simply reading and write data for SketchUp geometry.
The Ruby community isn’t really growing, is it? The web however is growing everyday with well maintained javascript libraries for just about any purpose.
Why I am telling this? Well, you can leverage all those javascript libraries in SketchUp as well by doing all the heavy lifting in Javascript code running in HtmlDialogs and passing data back and forth between ruby and javascript.
Here is a great library for reading and writing xlsx: xlsx - npm
Sure the HTML dialog could be small and display “Reading the spreadsheet file, please wait …”
But here you are complicating the challenge even more because a coder needs to know CSS, HTML, and JavaScript as well as Ruby. (We haven’t established what coding languages @cintellis.bvba knows yet.)
I would think it would be simplest to use the Ruby Standard library’s CSV class to read in a table exported from Excel.
If the xlsx format is familiar to the coder they might use the library’s REXML module, and write a simple iterator to read the table directly from the XML.
Depends on your viewpoint. I believe there has been an increase in support from some of the larger companies using Ruby. GitHub, Shopify, etc all have staff contributing to Ruby.
well maintained javascript libraries
node.js libraries != javascript libraries for use in CEF
As to Ruby and Excel, one might look at rubyXL. It requires Nokogiri, which, as most know, is an extension gem, and hence, very difficult to use in SU.
Re write_xlsx:
Quickly looking at info as you’ve done isn’t a good idea.
Often, the situation that you’ve described occurs when there is a desire to release a new major version with breaking changes. So, PRs/commits are accepted with breaking changes, but more work needs to be done. While that’s happening, there may also be commits that are fixes/bugs/non-breaking changes that warrant another release at the current major version.
Not sure about this particular gem, and the issue of ‘maintainer resources’ may affect things.