Matrix PHPExcel-读取矩阵excel以列开头

Matrix PHPExcel-读取矩阵excel以列开头,matrix,phpexcel,Matrix,Phpexcel,我刚开始使用PHPExcel。我有一些问题 我有这样一个Excel: id_price origin destination price 1 Miami Houston 20 2 Miami Washington DC 10 3 Miami

我刚开始使用PHPExcel。我有一些问题

我有这样一个Excel:

id_price          origin             destination          price
   1              Miami                Houston             20
   2              Miami              Washington DC         10
   3              Miami                Miami               0

第三行是我的出发地,第二列是我的目的地

我需要做的是读取这些数据以保存在数据库表中

例如,我的表价格

id_price          origin             destination          price
   1              Miami                Houston             20
   2              Florida              Houston             25
   3             New York              Houston             30
保存顺序不重要,可能是这样的:

id_price          origin             destination          price
   1              Miami                Houston             20
   2              Miami              Washington DC         10
   3              Miami                Miami               0
这就是我所拥有的:

include '../PHPExcel/PHPExcel/IOFactory.php';
$objPHPExcel = PHPExcel_IOFactory::load('example.xls');

$rowIterator = $objPHPExcel->getActiveSheet()->getRowIterator();

foreach ($rowIterator as $row) {

    if ($row->getRowIndex() > 2) { // starts with row 4

        echo '    - Row number: ' . $row->getRowIndex() . "\r\n";

        $cellIterator = $row->getCellIterator();

        foreach ($cellIterator as $cell) {
            $columnIndex = PHPExcel_Cell::columnIndexFromString($cell->getColumn());

            if ($columnIndex > 0) { // starts with column 'C'
                echo '        - Cell: ' . $cell->getCoordinate() . ' - ' . $cell->getCalculatedValue() . "\r\n";

                /**
                 * Here, I just get the name of the columns from left to right
                 * then, in the next iterator i have the values
                 */

            }
        }

    }

}
我真的不知道如何得到我需要的东西。谢谢你的帮助