Codeigniter Write data into Excel (Without using plugin/library)
Earlier I used to use a plugin for writing data into excel.But I found that it was very easy with codeigniter template parser. :)
These are the steps.
- Create an excel file (Here I have created testexcel.xls file inside upload folder)
- Give read write permission for this upload folder and the files.
- Load data from database.
- Pass retrieved data into a template and return it as a string.
- Then write that string into excel.
Controller
Model
Views
(This is the templete we use to create our table)
user_details_csv.php
That's all...No need any plugins or libraries.Here we can use styles as normal way we use to format a view.
1 Comments
my excel file not showing table format, it showing as data with table, tr, td tags. please how to avoid tags in my excel file.
ReplyDeletePost a Comment