<a href="#" id="tableName" onclick="downloadFile()">Импорт данных в Excel</a>
<br /><br />
<div id="tableWrap">
<table width="100%" border="1" cellpadding="3px" style="font-size: 12px; border-collapse: collapse; border: 1px solid gray;">
<tr>
<th>Наименование</th>
<th>Количество</th>
<th>Стоимость</th>
</tr>
</table>
</div>
<script type="text/javascript">
function downloadFile(){
var url='data:application/vnd.ms-excel,' + encodeURIComponent($('#tableWrap').html())
location.href=url
return false
}
</script>