phpphpexcelphpexcelreader

PHPExcel: How to check if cell value is a function


like in the title when i read an excel file i want to know if cell contain a value or a function. Is there a bool return method in PHPExcel like this?

$cell->getValue()->isFunction();

Thanks for the answers.


Solution

  • Not for the value, that wouldn't be possible because the value of a cell is a PHP scalar datatype, like boolean or string or float, so it can't have methods.

    But you can tell if a cell contains a formula by calling the cell's isFormula() method, which returns a boolean true/false

    $cell->isFormula();