I have a HTML table on my PHP page,that I want to export to excel file and available this file for user download on a button click . How can I do this using jQuery or PHP ? .Any code examples to demo. this would be great
1 Answer
You have to post the html markup of the table you have on the page or create the same markup on the server side and then use the below code to export it into excel format.
<?php
$file="test.xls";
$test="TheTableMarkupWillGoHere";
header("Content-type: application/vnd.ms-excel");
header("Content-Disposition: attachment; filename=$file");
echo $test;
?>