Answer the question
In order to leave comments, you need to log in
How to get PHPExcel column array?
Good afternoon, tell me if there is a method in PHPExcel to get all the values in a column into an array and similar with the construction?
Answer the question
In order to leave comments, you need to log in
issue resolved
$sheet = $objPHPExcel->getActiveSheet();
$array_data = array();
foreach($sheet->getRowIterator() as $row){
$rowIndex = $row->getRowIndex ();
$array_data[$rowIndex] = array('A'=>'', 'B'=>'','C'=>'','D'=>'');
$cell = $sheet->getCell('A' . $rowIndex);
$array_data[$rowIndex]['A'] = $cell->getCalculatedValue();
$cell = $sheet->getCell('B' . $rowIndex);
$array_data[$rowIndex]['B'] = $cell->getCalculatedValue();
$cell = $sheet->getCell('C' . $rowIndex);
$array_data[$rowIndex]['C'] = $cell->getCalculatedValue();
$cell = $sheet->getCell('D' . $rowIndex);
$array_data[$rowIndex]['D'] = $cell->getCalculatedValue();
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question