PHP code example of fissible / transmark-xlsx

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

    

fissible / transmark-xlsx example snippets


use Fissible\Transmark\Xlsx\XlsxReader;

$bytes = file_get_contents('report.xlsx');
$workbook = (new XlsxReader())->read($bytes);

$sheet = $workbook->sheet('Sheet1');
$sheet->cellAt('A1')->value();   // by A1-style reference
$sheet->cell(1, 1)->value();     // by (row, col) coordinate — both address the same cell

use Fissible\Transmark\Xlsx\{Cell, Sheet, Workbook, XlsxWriter};

$sheet = new Sheet('Sheet1');
$sheet->setCellAt('A1', Cell::string('Hello, World.'));
$sheet->setCellAt('A2', Cell::number(42.5));
$sheet->setCellAt('A3', Cell::boolean(true));
$sheet->setCellAt('A4', Cell::formula('A2', 42.5)); // formula text + last-known cached value

$workbook = new Workbook();
$workbook->addSheet($sheet);

$bytes = (new XlsxWriter())->write($workbook);
file_put_contents('report.xlsx', $bytes);

$cell = Cell::formula('SUM(A1:A10)', 55.0);
$cell->formulaText(); // 'SUM(A1:A10)'
$cell->value();       // 55.0 — the cached result, not recomputed by this package