PHP code example of duncan3dc / phpexcel

1. Go to this page and download the library: Download duncan3dc/phpexcel library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

duncan3dc / phpexcel example snippets


use duncan3dc\Excel;

$excel = new Excel();

$excel->setCell("A1","Title", Excel::BOLD | EXCEL::CENTER);

for($i = 1; $i < 10; $i++) {
    $cell = $excel->getCellName($i,1);
    $excel->setCell($cell,"Test " . $i);
}

for($i = 1; $i < 10; $i++) {
    $cell = Excel::getCellName($i,2);
    $excel->setCell($cell,"Value " . $i);
}

$excel->save("/tmp/text.xls");