将html结果的内容导出为ex​​cel表

时间:2015-08-24 09:06:57

标签: php html export-to-excel

我正在尝试将结果哦html页面以.xlsx或.csv格式存储到Excel工作表中。 以下是结果enter image description here

的快照

我正在尝试将此内容保存在excel表中,
下面我尝试了这个PHP脚本,但它只打印列标题,但没有数据。

<?php
$file="demo.xls";
$test="<table  ><tr><td>Sl_No</td><td>Sample_ID</td><td>Run</td><td>Sequence</td><td>Obtained_read</td><td>Location</td></tr></table>";
header("Content-type: application/vnd.ms-excel");
header("Content-Disposition: attachment; filename=$file");
echo $test;
?> 

如何实现这一目标? 在此先感谢!!!

0 个答案:

没有答案