Accessing cells - PhpSpreadsheet Documentation

PHOTO EMBED

Mon Feb 20 2023 23:32:52 GMT+0000 (Coordinated Universal Time)

Saved by @mvieira

// Set cell A1 with a string value
$spreadsheet->getActiveSheet()->setCellValue('A1', 'PhpSpreadsheet');

// Set cell A2 with a numeric value
$spreadsheet->getActiveSheet()->setCellValue('A2', 12345.6789);

// Set cell A3 with a boolean value
$spreadsheet->getActiveSheet()->setCellValue('A3', TRUE);

// Set cell A4 with a formula
$spreadsheet->getActiveSheet()->setCellValue(
    'A4',
    '=IF(A3, CONCATENATE(A1, " ", A2), CONCATENATE(A2, " ", A1))'
);
content_copyCOPY

https://phpspreadsheet.readthedocs.io/en/latest/topics/accessing-cells/