Using the IF statement in PHPspreadsheet

691 views Asked by At

I create an excel report in php using the phpspreadsheet library. But I ran into a problem: I need to use the "IF" operator in one column as in excel.

$spreadsheet->getActiveSheet()->setCellValue("O{$row_number}", "=IF(A{$row_number}>10;1;0)")

But when I open the document, I get an error that the document is damaged. Can you tell me how to implement this correctly?

1

There are 1 answers

0
Dr_Wollo On

Replace ";" with ",". Try

=IF(A{$row_number}>10,1,0).