Welcome Guest, Not a member yet? Register   Sign In
Reading large Excel files
#1

I need to import a relatively large .xlsx file (40,000 rows, 15 columns) into my database.
I tried the PHPExcel library, but it gives a memory error.
I've found a library that should be able to read a big file row by row: Spout.

I created a folder named "spout" in application/third_party.
In that folder, the directory structure of Spout looks like this:
Autoloader
Common
Reader
Writer

In the application/libraries folder, I created a file named Spout.php, with this contents:
PHP Code:
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
 
require_once 
APPPATH '/third_party/spout/Autoloader/autoload.php';
use 
Box\Spout\Reader\ReaderFactory;
use 
Box\Spout\Common\Type;    
        
class 
Spout 
 
   public function __construct() { 
    
 
   


In my Import.php controller, I have this:
PHP Code:
$this->load->library('spout');
$reader ReaderFactory::create(Type::XLSX); // for XLSX files 

But CI gives an error:
Code:
A PHP Error was encountered
Severity: Error
Message: Class 'ReaderFactory' not found
Filename: controllers/Import.php
Line Number: 346

I'm making some fundamental mistake, I guess. Who can help me to get this working?
Reply


Messages In This Thread
Reading large Excel files - by Wouter60 - 08-14-2017, 12:01 PM
RE: Reading large Excel files - by Paradinight - 08-14-2017, 12:15 PM
RE: Reading large Excel files - by InsiteFX - 08-14-2017, 12:23 PM
RE: Reading large Excel files - by Wouter60 - 08-14-2017, 01:04 PM
RE: Reading large Excel files - by dsivic - 08-14-2017, 01:23 PM
RE: Reading large Excel files - by Wouter60 - 08-14-2017, 02:03 PM
RE: Reading large Excel files - by Paradinight - 08-14-2017, 11:51 PM
RE: Reading large Excel files - by Wouter60 - 08-15-2017, 11:27 AM
RE: Reading large Excel files - by projack89 - 08-15-2017, 02:32 AM
RE: Reading large Excel files - by tksains - 08-23-2017, 08:36 PM



Theme © iAndrew 2016 - Forum software by © MyBB