it-poet/excel-keys-replacer

A package to replace special labels in Excel files matching array keys.

0.0.1 2017-03-31 03:46 UTC

This package is not auto-updated.

Last update: 2024-05-31 17:40:11 UTC


README

Use Excel files as templates. This package will replace special labels in Excel files (both xls and xlsx) matching array keys.
Required: phpoffice/phpexcel.
Install via composer:
composer require it-poet/excel-keys-replacer

Example:
Insert anywhere in xls_keys.xls in any cells ${key1}$ and ${key2}$.

$excel = new \ItPoet\ExcelKeysReplacer\Replacer;  
$excel->file('path/to/file/xls_keys.xls');            
$excel->data([  
    'key1' => 'some text',  
    'key2' => '12345',  
]);  
$xls = $excel->replace();  
$writer = new \PHPExcel_Writer_Excel5($xls);  
$writer->save('path/to/file/xls_replaced.xls'); 

Optionally (with default values):

$excel->keyWrapper('${', '}$');  
$excel->sheet(0);

TODO:

  • multi-row insert to build tables (if key is array).