2017 © Pedro Peláez
 

library exceltofiles

Simple library to create files by excel rows

image

fdmsantos/exceltofiles

Simple library to create files by excel rows

  • Monday, January 8, 2018
  • by fdmsantos
  • Repository
  • 0 Watchers
  • 0 Stars
  • 5 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 2 Versions
  • 0 % Grown

The README.md

Excel to files

fdmsantos/exceltofiles is a simple library to create files by excel row based on a template., (*1)

How To Use

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)

The Versions

08/01 2018

dev-master

9999999-dev

Simple library to create files by excel rows

  Sources   Download

Apache-2.0

The Requires

 

by Fabio Santos

php excel files map

08/01 2018

v1.1

1.1.0.0

Simple library to create files by excel rows

  Sources   Download

Apache-2.0

The Requires

 

by Fabio Santos

php excel files map