dev-master
9999999-devSimple library to create files by excel rows
Apache-2.0
The Requires
by Fabio Santos
php excel files map
v1.1
1.1.0.0Simple library to create files by excel rows
Apache-2.0
The Requires
by Fabio Santos
php excel files map
Wallogit.com
2017 © Pedro Peláez
Simple library to create files by excel rows
fdmsantos/exceltofiles is a simple library to create files by excel row based on a template., (*1)
We need Give a Template File and The Excel File., (*2)
Template File Example:, (*3)
Hello my name is [name].
I'm from [country] and have [age] years old!
````
Excel File Example:
| A | B | C |
| -------|-----------| ---|
| Fabio | Portugal | 31 |
| John | Spain | 23 |
| Peter | England | 65 |
Code Example:
```php
require_once('vendor/autoload.php');
use ExcelToFiles\ExcelToFiles;
$exceltoFiles = new ExcelToFiles([
'template' => 'template.txt',
'excel' => 'excel.xls',
'mapping' => [
'[name]' => 'A'
'[country]' => 'B'
'[age]' => 'C'
]);
$exceltoFiles->generate();
The result from code above will be :, (*4)
File 1: ```txt Hello my name is Fabio. I'm from Portugal and have 31 years old!, (*5)
File 2: ```txt Hello my name is John. I'm from Spain and have 23 years old!
File 3: ```txt Hello my name is Peter. I'm from England and have 65 years old!, (*6)
Optional Params: ```php require_once('vendor/autoload.php'); use ExcelToFiles\ExcelToFiles; $exceltoFiles = new ExcelToFiles([ 'template' => '{template.txt}', 'excel' => '{excel.xls}', 'excludeRows' => [1,2,13], // To exclude Rows. This example wil exclude row 1, 2 and 13 'filesname' => 'person_{A}.txt', // To define filename. The name can depends from excel row. For this it's necessary use {column}. 'outputdir' => 'src/', // To choose files path. The Default is current path. 'mapping' => [ '[name]' => 'A' '[country]' => 'B' '[age]' => 'C' ]);
Closures:, (*7)
If the template variables have same logical or depends from two or more columns, we can use closures., (*8)
```php // One Clousure for Variable $exceltoFiles->mapWithClosure('[name]',function($columns) { return $columns['A'].' => '.$columns['B']; });, (*9)
$exceltoFiles->generate(); ````, (*10)
Simple library to create files by excel rows
Apache-2.0
php excel files map
Simple library to create files by excel rows
Apache-2.0
php excel files map