1

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

1 Answer 1

1

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;
?>
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.