Home » Php » php – Reading hyperlink URL

php – Reading hyperlink URL

Posted by: admin July 12, 2020 Leave a comment

Questions:

How do I read the URL of a hyperlink within a cell using PHPExcel?

How to&Answers:
$url = $objPHPExcel->getActiveSheet()->getCell('E26')->getHyperlink()->getUrl();

EDIT

you might want to test whether the cell has a hyperlink first

$objPHPExcel->getActiveSheet()->getCell('E26')->hasHyperlink();

EDIT 2

Note that hyperlinks are not loaded when setReadDataOnly(true)