Search code examples
phpphpexcel

Reading hyperlink URL


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


Solution

  • $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)