Reputation: 549
I've been working with PHPExcel, and I have been able to take dataset data and create arrays on large data sets. But if I want to allow my client to draw data from a single cell, I can't seem to make this work.
What I'm looking to do exactly is take data from a single cell in excel and place it in a PHP variable.
Upvotes: 2
Views: 1565
Reputation: 212452
Assuming you're using PHPExcel as your library.
To get the "raw" cell value:
$cellA1Value = $objPHPExcel->getActiveSheet()->getCell('A1')->getValue();
or to get the calculated value for a cell containing a formula:
$cellB2Value = $objPHPExcel->getActiveSheet()->getCell('B2')->getCalculatedValue()
or to get the formatted value for a cell:
$cellC3Value = $objPHPExcel->getActiveSheet()->getCell('C3')->getFormattedValue()
Upvotes: 3