PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Tuesday, October 4, 2022

[FIXED] how to use akeneo-labs spreadsheet-parser to parse large Excel worksheet

 October 04, 2022     akeneo, php, phpexcel     No comments   

Issue

I downloaded the packages from https://github.com/akeneo/spreadsheet-parser and when I run it from my php file "as in Usage", I got the error

Fatal error: Class 'Akeneo\Component\SpreadsheetParser\SpreadsheetParser' not found
  • P.S. I'm using WAMP the latest version, windows 7

thanks


Solution

I contacted with the author, and I figured out that I didn't install composer.. and as I don't know anything about it, so he did some edits on his code, and send it to me, so I can use it directly.. anyways, I'll put a snippet of php code, beside that I'll upload the file, to help anyone how face the same problem, and need to parse large worksheet xlsx or csv

<?php 

require 'vendor/autoload.php';

use Akeneo\Component\SpreadsheetParser\SpreadsheetParser;

$workbook = SpreadsheetParser::open('FL_insurance_sample.csv');

$myWorksheetIndex = $workbook->getWorksheetIndex('myworksheet');

foreach ($workbook->createRowIterator($myWorksheetIndex) as $rowIndex => $values) {
    echo implode(',',$values);
}
?>
  • you can download the package directly from here: csv_parser.zip


Answered By - Hossam
Answer Checked By - David Goodson (PHPFixing Volunteer)
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home
View mobile version

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing