2017 © Pedro Peláez
 

library phpexcelformatter

PHPExcelFormatter is class to make it more simple to get data from Excel documents.

image

renekorss/phpexcelformatter

PHPExcelFormatter is class to make it more simple to get data from Excel documents.

  • Friday, November 25, 2016
  • by renekorss
  • Repository
  • 3 Watchers
  • 2 Stars
  • 58 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 2 Forks
  • 0 Open issues
  • 3 Versions
  • 4 % Grown

The README.md

Actions Status Coverage Status Latest Stable Version Total Downloads License, (*1)

PHPExcelFormatter

PHPExcelFormatter is class to make getting data from Excel documents simpler., (*2)

  • Read columns what you really need
  • Set column names for documents what dosen't have column names on first row
  • Set your DB field names for columns
  • Retrieve data in array or MySQL query format
  • Greate for importing files and then letting user to connect document columns with your DB fields :) (example coming)

Install

composer require renekorss/phpexcelformatter

Usage

// Require needed files
require __DIR__ . '/vendor/autoload.php';

use RKD\PHPExcelFormatter\PHPExcelFormatter;
use RKD\PHPExcelFormatter\Exception\PHPExcelFormatterException;

try {
  // Load file
  $formatter = new PHPExcelFormatter('example1.xls');

  // Output columns array (document must have column names on first row)
  $formatterColumns = array(
    'username' => 'username',
    'phone'    => 'phone_no',
    'email'    => 'email_address'
  );

  // Output columns array (document dosen't have column names on first row)
  // Skip fourth column (age) (third in array), because we don't need that data
  // NOTE: if document dosen't have column names on first line, second parameter for PHPExcelFormatter should be $readColumns = false, otherwise it will skip first line of data
  $formatterColumns = array(
    'username',
    'email_address',
    'phone',
    4 => 'sex'
  );

  // Set our columns
  $formatter->setFormatterColumns($formatterColumns);

  // Output as array
  $output = $formatter->output('a');
  // OR
  // $output = $formatter->output('array');

  // Print array
  echo '

'.print_r($output, true).'
'; // Set MySQL table $formatter->setMySQLTableName('users'); // Output as mysql query $output = $formatter->output('m'); // OR // $output = $formatter->output('mysql'); // Print mysql query echo '
'.print_r($output, true).'
'; } catch (PHPExcelFormatterException $e) { echo 'Error: '.$e->getMessage(); }

View examples, (*3)

License

PHPExcelFormatter is licensed under MIT, (*4)

The Versions

25/11 2016

dev-master

9999999-dev https://github.com/renekorss/PHPExcelFormatter

PHPExcelFormatter is class to make it more simple to get data from Excel documents.

  Sources   Download

MIT

The Requires

 

php excel xls spreadsheet xlsx format

16/09 2016

v2.0.1

2.0.1.0 https://github.com/renekorss/PHPExcelFormatter

PHPExcelFormatter is class to make it more simple to get data from Excel documents.

  Sources   Download

MIT

The Requires

 

php excel xls spreadsheet xlsx format

16/09 2016

v2.0.0

2.0.0.0 https://github.com/renekorss/PHPExcelFormatter

PHPExcelFormatter is class to make it more simple to get data from Excel documents.

  Sources   Download

MIT

The Requires

 

php excel xls spreadsheet xlsx format