Recently I realised a strange behaviour of roo gem when working with tabs (sheets). Here’s what works non-intuitively in my opinion.
So I opened the file and assigned sheets to variables
the_file = Roo::Excelx.new(file_path.to_s)
sheet1 = the_file.sheet(0) # or the_file.sheet('Sheet 1')
sheet2 = the_file.sheet(1) # or the_file.sheet('Sheet 2')
Then trying to iterate through rows of sheet1
I was getting sheet2
rows.
It turned out that roo
uses sheet(sheet_name)
method to set a kind of pointer to the sheet. roo
doesn’t let you to assign sheets to different variables at the same time.
What do you think? Am I right or there’s an other cause of this problem?
Comments
Empty! You must sign in to add comments.