Akino
Akino

Reputation: 313

Add PHPExcel_IOFactory to symfony project

I want to use php script to import data from excel file to mysql data base

I found this turorial Here which is so clear but in my case I use symfony framework and I don't know how can I include phpExcel_IOFactory . can someone help me please?

Upvotes: 0

Views: 643

Answers (2)

Cerad
Cerad

Reputation: 48865

composer require phpoffice/phpexcel 

will take care of installing and loading the classes. After that, just use something like:

$reader = \PHPExcel_IOFactory::createReaderForFile($filename);
$reader->setReadDataOnly(true);

$wb = $reader->load($filename);
$ws = $wb->getSheet(0);

Note the forward slash in front of the class name.

Upvotes: 3

metfan
metfan

Reputation: 98

Simple you have to add phpoffice/phpexcel in your vendors. run:

php composer.phar require phpoffice/phpexcel

And that's all.

Upvotes: 0

Related Questions