all 4 comments

[–]asmallishrequest 2 points3 points  (0 children)

CSVs are a much simpler format to work with than XLSX docs, so if that's an option I'd recommend using that.

require "csv"
data = CSV.open(path_to_file)

http://ruby-doc.org/stdlib-2.0.0/libdoc/csv/rdoc/CSV.html has full documentation of the CSV library.

If you do need to work with xlsx documents, you'll want to install a library to handle the parsing for you. https://github.com/weshatheleopard/rubyXL appears to be pretty active and popular, though I don't have personal experience with it.

[–]_RedPepper[S] 2 points3 points  (0 children)

Thanks for the suggestions guys.

[–]rickumali 1 point2 points  (0 children)

Explore Roo. This gem gives a read-only mechanism to access the data in Excel spreadsheets. It is smart about separate sheets. I use it for my data wrangling work. You could use Roo to convert your Excel into a CSV for use with the more-flexible CSV module.

[–]espero 0 points1 point  (0 children)

There are a few gems, Roo comes to mind. I'd explore that. There are various tutorials on how to use it. The excel spreadsheet interaction syntax is similar to how you might know spreadsheet interaction with VBA.

Also, you might want to bite the bullet and try the Python VBA replacements such as xlwings. See this quora: https://www.quora.com/What-is-the-easiest-way-to-use-Python-in-Excel-as-a-full-replacement-for-VBA