Today, We want to share with you PHP Split Export convert Multiple Excel Sheet Files.
In this post we will show you Exporting CSV to multiple excel worksheets in PHP, hear for Split large Excel/Csv file to multiple files on PHP or Javascrip we will give you demo and example for implement.
In this post, we will learn about Split and Export into Multiple Excel Sheet Files using PHP with an example.
PHP Split Export convert Multiple Excel Sheet Files
There are the Following The simple About PHP Split Export convert Multiple Excel Sheet Files Full Information With Example and Source code.First of all You simple Create There are The folder and file structure list below.
- jquery-3.2.1.min
- tbl_member
- index.php
- splitData.php
- DBController.php
Database Script
tbl_member
-- -- Table structure for table `tbl_member` -- CREATE TABLE `tbl_member` ( `id` int(11) NOT NULL COMMENT 'primary key', `member_name` varchar(255) NOT NULL COMMENT 'member name', `member_salary` double NOT NULL COMMENT 'member salary', `member_age` int(11) NOT NULL COMMENT 'member age' ) ENGINE=InnoDB DEFAULT CHARSET=latin1 COMMENT='datatable demo table'; -- -- Dumping data for table `tbl_member` -- INSERT INTO `tbl_member` (`id`, `member_name`, `member_salary`, `member_age`) VALUES (1, 'Krunal', 20800, 61), (2, 'Ankit', 10750, 63), (6, 'Chirag', 37200, 61), (7, 'Rahul Gandhi', 137500, 59), (8, 'Jaydeep', 32790, 55), (11, 'Modi', 90560, 40), (13, 'Vijay', 85000, 36); -- -- Indexes for dumped tables -- -- -- Indexes for table `tbl_member` -- ALTER TABLE `tbl_member` ADD PRIMARY KEY (`id`); COMMIT;
Database Result List with Export Action Control
index.php
runBaseQuery($query); ?>PHP Split and Export into Multiple Excel Sheet Files body { font-family: Arial; width: 550px; } .member-table-card { border: #e0dfdf 1px solid; border-radius: 2px; width: 100%; } .member-table-card th { background: #3d3d3d; padding: 15px; text-align: left; } .member-table-card td { padding: 15px; border-bottom: #e8e8e8 1px solid; } .btn-submit { padding: 15px 30px; background: #c60000; border: #1d1d1d 1px solid; color: #f0f0f0; font-size: 0.9em; border-radius: 2px; cursor: pointer; margin-top: 15px; }PHP Split and Export into Multiple Excel Sheet Files
Member ID | Member Name | Member Salary | Member Age |
---|---|---|---|
splitData.php
<?php require_once ("DBController.php"); $conn_manage = new DBController(); define("RECORD_LIMIT_PER_FILE", 5); $counter = 0; $rowcount = $_POST["record_count"]; $lastPageNo = ceil($rowcount / RECORD_LIMIT_PER_FILE); for ($i = $counter; $i runBaseQuery($query); $splitHTML[$i] = '
ID | Member Name | Member Salary | Member Age |
---|---|---|---|
' . $response[$k]['id'] . ' | ' . $response[$k]['member_name'] . ' | ' . $response[$k]['member_salary'] . ' | ' . $response[$k]['member_age'] . ' |
DBController
DBController.php
conn = $this->connectDB(); } function connectDB() { $conn = mysqli_connect($this->host,$this->user,$this->password,$this->database); return $conn; } function runBaseQuery($query) { $response = $this->conn->query($query); if ($response->num_rows > 0) { while($row = $response->fetch_assoc()) { $responseset[] = $row; } } return $responseset; } function runQuery($query, $member_type, $member_value_array) { $sql = $this->conn->prepare($query); $this->bindQueryParams($sql, $member_type, $member_value_array); $sql->execute(); $response = $sql->get_response(); if ($response->num_rows > 0) { while($row = $response->fetch_assoc()) { $responseset[] = $row; } } if(!empty($responseset)) { return $responseset; } } function bindQueryParams($sql, $member_type, $member_value_array) { $member_value_reference[] = & $member_type; for($i=0; $i
Angular 6 CRUD Operations Application Tutorials
Read :
Summary
You can also read about AngularJS, ASP.NET, VueJs, PHP.
I hope you get an idea about How to split a large excel file into multiple smaller files.
I would like to have feedback on my Pakainfo.com blog.
Your valuable feedback, question, or comments about this article are always welcome.
If you enjoyed and liked this post, don’t forget to share.