Strange behaviour of roo gem when working with sheets (tabs)
08 Nov 07:40

Recently I realised a strange behaviour of roo gem when working with tabs (sheets). Here’s what works non-intuitively in my opinion.

The case

  • the file has two sheets: “Sheet 1”, “Sheet 2”
  • I wanted to iterate through rows in both sheets separately

So I opened the file and assigned sheets to variables

the_file =
sheet1 = the_file.sheet(0) # or the_file.sheet('Sheet 1')
sheet2 = the_file.sheet(1) # or the_file.sheet('Sheet 2')

The effect

Then trying to iterate through rows of sheet1 I was getting sheet2 rows.

The suspicion

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?


Empty! You must sign in to add comments.