Codeigniter – Export with PHP Excel

This video is about exporting data using third party library PHPExcel in Codeigniter.


Steps 1 – Get the required classes from

Step 2 – Import the PHP Excel class and PHP EXCEL Writer class

Step 3 – Write data to the file

Step 4 – Force to download using PHP output


Dharmesh Patel


Xem thêm bài viết khác:

30 thoughts on “Codeigniter – Export with PHP Excel”

  1. your explanation is very good.
    it works for me, but the problem is it take unnecessary 10 blank row before insert dynamic data.

  2. I am having trouble with this line can you help and explain this a little bit thank you sir,


    $tasks = new Task;
    $tasks->table = 'tasks';
    $data['tasks'] = $tasks->read();

  3. I am getting error like this:
    Severity: Warning

    Message: require(C:xampphtdocsCIapplication/third_party/PHPExcel/Classes/PHPExcel.php): failed to open stream: No such file or directory

    Filename: libraries/Excel.php

    Line Number: 3


    File: C:xampphtdocsCIapplicationlibrariesExcel.php
    Line: 3
    Function: _error_handler

    File: C:xampphtdocsCIapplicationlibrariesExcel.php
    Line: 3
    Function: require

    File: C:xampphtdocsCIapplicationcontrollersWelcome.php
    Line: 102
    Function: library

    File: C:xampphtdocsCIindex.php
    Line: 315
    Function: require_once

  4. Nice! But correct me if I am wrong – the content of the CSV and XSLX look identical.
    Doesn't it make more sense to stick with CSV – as far as performace and ease of coding goes?

  5. "Class 'Task' not found" im getting this error in line where the code is the $tasks = new Task; …. please help

  6. i can not open the file.. it say "The file format or file extension is not valid. Verify that the file has not been corrupted and that the file extension matches the format of the file."

  7. Hello Dharmesh Patel… I just want to say I like the way you explain CodeIgniter… All is clear with you !
    Please, if you have some times, can you explain us a big tutorial how to make a complete cms, with a login/logout system and different levels of users (example : administrators and writers and logged visitors who can just post comments).
    Thanks if you can… I'm just trying to do this in french in my youtube channel, and I'm curious about how the others are doing this !


Leave a Comment