2017 © Pedro Peláez
 

package excelreader

Simple and fast Excel .xlsx parser

image

tiempor3al/excelreader

Simple and fast Excel .xlsx parser

  • Tuesday, December 5, 2017
  • by tiempor3al
  • Repository
  • 1 Watchers
  • 0 Stars
  • 10 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 4 Versions
  • 0 % Grown

The README.md

ExcelReader is a very simple and fast Excel (.xlsx) parser with no third-party dependencies., (*1)


<?php require __DIR__ . '/vendor/autoload.php'; use tiempor3al\Excel\Reader as ExcelReader; if(!isset($argv[1])){ die("Missing Excel filename..."); } $reader = new ExcelReader(); $reader->Initialize($argv[1]); $worksheets = $reader->getWorksheets(); //We parse the first worksheet and the first two columns $generator = $reader->ParseWorksheet($worksheets[0], ['A:B']); //Since the library uses generators, it consumes little memory foreach ($generator as $cell) { if ($cell === ExcelReader::START_ROW) { //Do initialization stuff here printf("Start of row...\r\n"); } //if cell is an array then we get its value if (is_array($cell)) { //$cell holds four values: //'cell' => A8 - the position of the cell //'row' => 8 - the row of the cell //'col' => A - the column of the cell //'value' => xyz - the value of the cell //For values like strings and numbers, we can get the value in $cell['value'] if ($cell['col'] == 'A') { printf("Cell value: %s\r\n",$cell['value']); } //For dates we need to convert the values using the toDate method //Suppose that column B is filled with dates if ($cell['col'] == 'B') { //toDate returns a DateTime Object $date = $reader->toDate($cell['value']); printf("Cell value: %s\r\n",$date->format('Y-m-d')); } } if ($cell === ExcelReader::END_ROW) { printf("End of row...\r\n"); } }

The Versions

05/12 2017

dev-master

9999999-dev

Simple and fast Excel .xlsx parser

  Sources   Download

MIT

The Requires

  • php ^5.3|^7.0
  • ext-zip *
  • ext-xml *

 

by Manuel Martinez

05/12 2017

v1.2.0

1.2.0.0

Simple and fast Excel .xlsx parser

  Sources   Download

MIT

The Requires

  • php ^5.3|^7.0
  • ext-zip *
  • ext-xml *

 

by Manuel Martinez

05/12 2017

v1.1

1.1.0.0

Simple and fast Excel .xlsx parser

  Sources   Download

MIT

The Requires

  • php ^5.3|^7.0
  • ext-zip *
  • ext-xml *

 

by Manuel Martinez

04/12 2017

v1.0

1.0.0.0

Simple and fast Excel .xlsx parser

  Sources   Download

MIT

The Requires

  • php ^5.3|^7.0
  • ext-zip *
  • ext-xml *

 

by Manuel Martinez