Skip to main content

Export Data From PHP/MySQL to Microsoft Excel


This code will help you on how to export data from mysql database using PHP to Microsoft Excel. The feature of this code is it export data from mysql to ms excel readable format. Download and try this code and if you have question, just leave comment and i will answer all your question. database name: data

Note: Due to the size or complexity of this submission, the author has submitted it as a .zip file to shorten your download time. After downloading it, you will need a program like Winzip to decompress it.

Virus note: All files are scanned once-a-day by for viruses, but new viruses come out every day, so no prevention program can catch 100% of them.


1. Re-scan downloaded files using your personal virus checker before using it.
2. NEVER, EVER run compiled files (.exe's, .ocx's, .dll's etc.)--only run source code.


Submitted byNDAYIZEYE Maxim (not verified)on Fri, 11/16/2012 - 16:29

hello,i try to download this file and i tried to run them and i found this error"Notice: Undefined index: from in C:\xampp\htdocs\export\index.php on line 57 Notice: Undefined index: to in C:\xampp\htdocs\export\index.php on line 58"but are occur before entered item number. - next i tried to use that print button and it doesn't work for exporting those data to the Microsoft excel.
Submitted byAnonymous (not verified)on Fri, 01/11/2013 - 00:34

Hi, this not working on Chrome :( help me please
Submitted byAnonymous (not verified)on Wed, 02/13/2013 - 15:35

It is very useful...
how to insert excel data into php/mysql...

Submitted byAnonymous (not verified)on Thu, 07/18/2013 - 15:07

And how to apply styles? Please reply me...
Submitted byRanjana (not verified)on Sat, 02/08/2014 - 18:31

its working for me.... Thanks for sharing...
Submitted byangelica galvez (not verified)on Sun, 03/16/2014 - 22:20

its very useful but can you help me "2 or more data in one column in a row"just for other its a browser issue onclick="download();" is not working on some outdated browser like googletry mozilla..there it works for me.but not on google

Add new comment