PHP code example of nope7777 / xlsx-writer

1. Go to this page and download the library: Download nope7777/xlsx-writer 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/ */

    

nope7777 / xlsx-writer example snippets


use XLSXWriter\Workbook;

$workbook = new Workbook();

$workbook->getDefaultStyle()
    ->setFontName('Arial')
    ->setFontSize(9);

$sheet = $workbook->addSheet('Sheet title');
$sheet->addRow(
    ['Person', 'Company', 'Amount'],
    $workbook->getNewStyle()->setFontBold(true)
);
$sheet->skipRows(2);

$sheet->addRows([
    ['User1', 'Company1', 100],
    ['User2', 'Company2', 200],
    ['User3', 'Company3', 300],
]);

$workbook->output('some-export.xlsx');