public static function getRow($toString=true, $options=[], callable $callback=null)
    {
        $worksheet = self::validSheetObj();

        // Options
        $defaultOptions = [
            'columnOffset' => 0,
            'columns' => NULL,
            'timestamp' => true,
            'timestampFormat' => 'Y-m-d H:i:s', // False would use Unixtime
        ];
        $options = array_replace($defaultOptions, $options);

        // Calculate the column range of the worksheet
        $startColumn = ($options['columnOffset']) ?: 0;
        $columns = ($options['columns']) ?: self::alpha2num($worksheet->getHighestColumn());

        // Next row
        self::$_offsetRow++;

        // Check if exceed highest row by PHPSpreadsheet cachedHighestRow
        if (self::$_offsetRow > $worksheet->getHighestRow()) {
            return [];
        }

        // Fetch data from the sheet
        $data = [];
        for ($col = $startColumn + 1; $col <= $columns; ++$col) {
            $cell = $worksheet->getCellByColumnAndRow($col, self::$_offsetRow);
            $value = $cell->getValue();
            // Timestamp option
            if ($options['timestamp'] && \PhpOffice\PhpSpreadsheet\Shared\Date::isDateTime($cell)) {
                $value = \PhpOffice\PhpSpreadsheet\Shared\Date::excelToTimestamp($value);
                // Timestamp Format option
                $value = ($options['timestampFormat']) 
                    ? date($options['timestampFormat'], $value) : $value;
            }
            $value = ($toString) ? (string)$value : $value;
            // Callback function
            if ($callback) {
                $callback($value, $col, self::$_offsetRow);
            }
            $data[] = $value;
        }

        return $data;
    }
public static function getRow($toString=true, $options=[], callable $callback=null)
    {
        $worksheet = self::validSheetObj();

        // Options
        $defaultOptions = [
            'columnOffset' => 0,
            'columns' => NULL,
            'timestamp' => true,
            'timestampFormat' => 'Y-m-d H:i:s', // False would use Unixtime
        ];
        $options = array_replace($defaultOptions, $options);

        // Calculate the column range of the worksheet
        $startColumn = ($options['columnOffset']) ?: 0;
        $columns = ($options['columns']) ?: self::alpha2num($worksheet->getHighestColumn());

        // Next row
        self::$_offsetRow++;

        // Check if exceed highest row by PHPSpreadsheet cachedHighestRow
        if (self::$_offsetRow > $worksheet->getHighestRow()) {
            return [];
        }

        // Fetch data from the sheet
        $data = [];
        for ($col = $startColumn + 1; $col <= $columns; ++$col) {
            $cell = $worksheet->getCellByColumnAndRow($col, self::$_offsetRow);
            $value = $cell->getValue();
            // Timestamp option
            if ($options['timestamp'] && \PhpOffice\PhpSpreadsheet\Shared\Date::isDateTime($cell)) {
                $value = \PhpOffice\PhpSpreadsheet\Shared\Date::excelToTimestamp($value);
                // Timestamp Format option
                $value = ($options['timestampFormat']) 
                    ? date($options['timestampFormat'], $value) : $value;
            }
            $value = ($toString) ? (string)$value : $value;
            // Callback function
            if ($callback) {
                $callback($value, $col, self::$_offsetRow);
            }
            $data[] = $value;
        }

        return $data;
    }
public static function getRow ( $ toString = true , $ options = [ ] , callable $ callback = null ) { $ worksheet = self :: validSheetObj ( ) ; // Options $ defaultOptions = [ 'columnOffset' => 0 , 'columns' => NULL , 'timestamp' => true , 'timestampFormat' => 'Y-m-d H:i:s' , // False would use Unixtime ] ; $ options = array_replace ( $ defaultOptions , $ options ) ; // Calculate the column range of the worksheet $ startColumn = ( $ options [ 'columnOffset' ] ) ? : 0 ; $ columns = ( $ options [ 'columns' ] ) ? : self :: alpha2num ( $ worksheet -> getHighestColumn ( ) ) ; // Next row self :: $ _offsetRow ++ ; // Check if exceed highest row by PHPSpreadsheet cachedHighestRow if ( self :: $ _offsetRow > $ worksheet -> getHighestRow ( ) ) { return [ ] ; } // Fetch data from the sheet $ data = [ ] ; for ( $ col = $ startColumn + 1 ; $ col <= $ columns ; ++ $ col ) { $ cell = $ worksheet -> getCellByColumnAndRow ( $ col , self :: $ _offsetRow ) ; $ value = $ cell -> getValue ( ) ; // Timestamp option if ( $ options [ 'timestamp' ] && \ PhpOffice \ PhpSpreadsheet \ Shared \ Date :: isDateTime ( $ cell ) ) { $ value = \ PhpOffice \ PhpSpreadsheet \ Shared \ Date :: excelToTimestamp ( $ value ) ; // Timestamp Format option $ value = ( $ options [ 'timestampFormat' ] ) ? date ( $ options [ 'timestampFormat' ] , $ value ) : $ value ; } $ value = ( $ toString ) ? ( string ) $ value : $ value ; // Callback function if ( $ callback ) { $ callback ( $ value , $ col , self :: $ _offsetRow ) ; } $ data [ ] = $ value ; } return $ data ; }
Get data of a row from the actived sheet of PhpSpreadsheet

@param bool $toString All values from sheet to be string type
@param bool $options [
row (int) Ended row number
column (int) Ended column number
timestamp (bool) Excel datetime to Unixtime
timestampFormat (string) Format for date() when usgin timestamp
]
@param callable $callback($cellValue, int $columnIndex, int $rowIndex)
@return array Data of Spreadsheet
Get data of a row from the actived sheet of PhpSpreadsheet