Tuesday, October 4, 2022

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

Issue

I downloaded the packages from https://github.com/akeneo/spreadsheet-parser and when I run it from my 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 .. 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 code, beside that I'll upload the file, to help anyone how face the same problem, and need to parse large worksheet or

<?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);
}
?>


Answered By - Hossam
Answer Checked By - David Goodson (PHPFixing Volunteer)

No comments:

Post a Comment

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