Fixes undefined local variable or method `worksheet_index' after refactoring