Vendor/phpspreadsheet/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/LookupRef.php
public static function COLUMNS($cellAddress = null)
    {
        if ($cellAddress === null || $cellAddress === '') {
            return 1;
        } elseif (!is_array($cellAddress)) {
            return Functions::VALUE();
        }

        reset($cellAddress);
        $isMatrix = (is_numeric(key($cellAddress)));
        list($columns, $rows) = Calculation::getMatrixDimensions($cellAddress);

        if ($isMatrix) {
            return $rows;
        }

        return $columns;
    }
public static function COLUMNS($cellAddress = null)
    {
        if ($cellAddress === null || $cellAddress === '') {
            return 1;
        } elseif (!is_array($cellAddress)) {
            return Functions::VALUE();
        }

        reset($cellAddress);
        $isMatrix = (is_numeric(key($cellAddress)));
        list($columns, $rows) = Calculation::getMatrixDimensions($cellAddress);

        if ($isMatrix) {
            return $rows;
        }

        return $columns;
    }
COLUMNS.

Returns the number of columns in an array or reference.

Excel Function:
=COLUMNS(cellAddress)

@param null|array|string $cellAddress An array or array formula, or a reference to a range of cells for which you want the number of columns

@return int The number of columns in cellAddress