As noted in other posts here, the roo
gem
has some convoluted documents, and I can't figure out how to iterate through a xlsx
workbook
's sheets
, then each sheet
's rows.
Iterating through each sheet
only comes up with the sheet
's name, not a reference to the sheet
itself. So I have to declare it. Still has no way of iterating through all rows
.
s = '/Users/user3/Desktop/departments.xlsx'
a = Roo::Spreadsheet.open(s)
sheets = a.sheets.reverse
sheets.each_with_index do |index, i|
sheet = a.sheet(index)
sheet.each_row do|row|
puts row
end
end
Other examples on the roo
documentation assume there is a default sheet
, and a single sheet in a workbook
file. Not my case, so it gets confusing quickly.
How can I iterate through every sheet, then ever row, for testing and inclusion into my analysis? The spreadsheet I'm working with has a blank column and many rows, and some artwork...typical office stuff. These people are not data people. Getting around their 'creativity' in spreadsheets is done by iteration and testing of every row, then stripping blank cells.
Anybody with some insight truly appreciated.
Solved: use the
Creek
gem
. Kudos to @Rajagopalan for this.