is there any to export data from mysql to excelsheet through PHP..


Thanks in advance..!! :D

Recommended Answers

All 3 Replies

I would suggest using the PHPExcel script.

It isn't through PHP but if you don't mind doing it manually, use PHPMyAdmin to do it (Most web hosts provide it as the tool to manage your MySQL database).

Select the fields from database and use the below code.

$filename="excelsheet";
header("Content-type: application/excel");
header("Content-Disposition: attachment; filename=".$filename.".xls");
header("Pragma: no-cache");
header("Expires: 0");

echo"'<table>
<tr><th>column 1</th>
<th>column 2</th>";


I think this will help u..

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.