From 5277073210c711a1ab84d2a0e4b3a2ad3c71e835 Mon Sep 17 00:00:00 2001 From: Adam Kiczula Date: Sat, 20 May 2023 09:21:01 -0500 Subject: Fix sheet_by_name for sheets with escaped characters --- lib/axlsx/workbook/workbook.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'lib') diff --git a/lib/axlsx/workbook/workbook.rb b/lib/axlsx/workbook/workbook.rb index 1a2f0488..da36e9a0 100644 --- a/lib/axlsx/workbook/workbook.rb +++ b/lib/axlsx/workbook/workbook.rb @@ -221,8 +221,8 @@ module Axlsx # @param [String] name The name of the sheet you are looking for # @return [Worksheet] The sheet found, or nil def sheet_by_name(name) - index = @worksheets.index { |sheet| sheet.name == name } - @worksheets[index] if index + encoded_name = Axlsx.coder.encode(name) + @worksheets.find { |sheet| sheet.name == encoded_name } end # Creates a new Workbook. -- cgit v1.2.3