Using phpExcel, I have managed to read the whole worksheet. Is there a way I can read only certain values say from cell C15:C18, to insert them into the database?
There are plenty of methods:
$cellValue = $objPHPExcel->getActiveSheet()->getCell('C15')->getValue();
will read the value of a specific cell (C15 in this case) into the variable $cellValue
or
$cellValues = $objPHPExcel->getActiveSheet()->rangeToArray('C15:C18');
will read a range of values to an array.
Once you've retrieved the contents of a cell to a normal PHP variable, it's easy enough to insert them into a database as you'd insert any data avalues into a database.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With