Is there a way when using roo to get the coordinates of a cell (or just the row) containing a predefined value?
For instance, having cell A,3 with content "HERE", I need, passing "HERE" to get (A,3) or just 3.
Thanks.
Is there a way when using roo to get the coordinates of a cell (or just the row) containing a predefined value?
For instance, having cell A,3 with content "HERE", I need, passing "HERE" to get (A,3) or just 3.
Thanks.
I used roo for the first time today, and it doesn't feel Rubyish at all. There might be a better way, but this code worked fine for a simple example :
require 'roo'
xlsx = Roo::Excelx.new("roo.xlsx")
cell = xlsx.each_row_streaming.to_a.flatten.find do |c|
c.value.to_s.include?('hello')
end
if cell
p cell.coordinate
#=> #<Roo::Excelx::Coordinate:0x000000028ea6a0 @row=6, @column=1>
p cell.value
#=> "hello world"
end
Note that it reads the whole spreadsheet even if the first cell is a match.