MNB PHPExcelDeveloper Guide

Date examples

Date Excel examples, explained clearly.

Open a focused example to see the implementation path, copy-ready PHP, expected workbook behavior, and the production boundary that matters.

4examples in this category
21supported categories
5implementation paths
Monolithic library

Date examples with copy-ready, production-minded PHP.

Each example identifies the exact methods it uses and can be opened independently from the right-side index.

4
examples
4
documented methods
Example 01

TODAY()

MnbExcel::formula()dateStyleColumns()
today.php
<?php

declare(strict_types=1);

/*
Summary:
    Insert the current date as a volatile Excel formula and apply a date number format.

Implementation note:
    TODAY recalculates according to the spreadsheet application and client system date.
*/

use Mnb\PHPExcel\MnbExcel;

$rows = [[
    'Report' => 'Daily sales',
    'Report date' => MnbExcel::formula('TODAY()', date('Y-m-d')),
]];

MnbExcel::fromArray($rows)
    ->withHeader()
    ->dateStyleColumns(['Report date'], 'yyyy-mm-dd')
    ->save('today.xlsx');