https://github.com/mazahirharoon/read_excel-codeigniter
PHP (Codeigniter) code to read excel sheets and insert (or update) data to SQL table
https://github.com/mazahirharoon/read_excel-codeigniter
codeigniter codeigniter3 excel excelreader php xlsx
Last synced: 4 days ago
JSON representation
PHP (Codeigniter) code to read excel sheets and insert (or update) data to SQL table
- Host: GitHub
- URL: https://github.com/mazahirharoon/read_excel-codeigniter
- Owner: MazahirHaroon
- License: mit
- Created: 2018-01-29T13:54:36.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2018-01-29T15:27:00.000Z (over 8 years ago)
- Last Synced: 2025-03-14T16:44:19.575Z (about 1 year ago)
- Topics: codeigniter, codeigniter3, excel, excelreader, php, xlsx
- Language: HTML
- Homepage:
- Size: 3.32 MB
- Stars: 0
- Watchers: 0
- Forks: 3
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Contributing: contributing.md
- License: LICENSE
Awesome Lists containing this project
README
# Read_Excel-PHP
A PHP (Codeigniter) code to read excel sheets and insert (or update) data to SQL table
### Technologies used ###
* [Codeigniter Version 3](https://codeigniter.com/)
* PHP 7.0.10
* MySQL 5.7.14
* Uses [PhpSpreadsheet Library](https://github.com/PHPOffice/PhpSpreadsheet)
## Contents:
1. Source Code:
* A controller function 'updateTable' to read excel file and create an array of arrays.
* A modal function 'updateCityTable' to insert the array to the database table.
2. A test excel file 'test_data' with one sheet 'City'.
3. A SQL file 'excel.sql' to create the table (As per the sheet in the excel file)
4. PhpSpreadSheet Libary files.
### How do I get set up? ###
* To run server side code locally you can use LAMP, WAMP, MAMP, or XAMP
* Clone the file and make the necessary changes.
- .\application\config\config.php
* Change $base_url
- .\.htaccess
* RewriteBase \foldername
- .\application\config\database.php
* Change the databasse name, username and password
* Create a database and import excel.sql file into it, to create the table as per the sheet in the excel file.
(Read this [Documentation](https://codeigniter.com/user_guide/) for issues regarding Codeigniter)
### How to run the code? ###
Go to the link http://localhost/"your_base_url_here_if_any"/Read_Excel-PHP/mainctrl/UpdateTable
And the table you have created should be populated with the data.
PS: I have switched of the databse debug in .\application\config\database.php, for debugging purpose change the line,
* 'db_debug' => FALSE, To
* 'db_debug' => (ENVIRONMENT !== 'production')
### PhpSpreadsheet Library ###
Make sure that you download the latest version of `PhpSpreadsheet Library` file from
the releases section **[here](https://github.com/PHPOffice/PhpSpreadsheet)**.
(The vendor folder contains the downloaded PhpSpreadsheet Library files in this project)
### Who do I talk to? ###
* [Mazahir Haroon](mailto:mazahirharoon@gmail.com?Subject=Regarding%20Read_Excel-PHP)