require_once 'path/to/PHPExcel.php'; $objPHPExcel = new PHPExcel(); $range = 'A1:C3'; $separator = ','; $splitRange = PHPExcel_Cell::splitRange($range, $separator); print_r($splitRange);
Array ( [0] => A1 [1] => B1 [2] => C1 [3] => A2 [4] => B2 [5] => C2 [6] => A3 [7] => B3 [8] => C3 )
require_once 'path/to/PHPExcel.php'; $objPHPExcel = new PHPExcel(); $range = 'A1:C3'; $separator = ':'; $splitRange = PHPExcel_Cell::splitRange($range, $separator); print_r($splitRange);
Array ( [0] => A1:B1:C1 [1] => A2:B2:C2 [2] => A3:B3:C3 )In both examples, we used the PHPExcel_Cell splitRange method to split a range of cells into individual cells using different separators. We then printed out the resulting array to see the output. It's important to note that this method is not part of the core PHP library, but rather a package library called PHPExcel.