diff --git a/src/PhpSpreadsheet/Worksheet/Worksheet.php b/src/PhpSpreadsheet/Worksheet/Worksheet.php index 2ba3f08187..35f0c7f99d 100644 --- a/src/PhpSpreadsheet/Worksheet/Worksheet.php +++ b/src/PhpSpreadsheet/Worksheet/Worksheet.php @@ -3112,7 +3112,14 @@ public static function extractSheetTitle(?string $range, bool $returnRange = fal } if ($returnRange) { - return [substr($range, 0, $sep), substr($range, $sep + 1)]; + $sheet = substr($range, 0, $sep); + if (($pos = strpos($sheet, "'")) !== false) { + $sheet = substr_replace($sheet, '', $pos, 1); + } + if (($pos = strrpos($sheet, "'")) !== false) { + $sheet = substr_replace($sheet, '', $pos, 1); + } + return [$sheet, substr($range, $sep + 1)]; } return substr($range, $sep + 1);