From this article i found this code snippet that imports html data to excel:

<%
Response.ContentType = "application/vnd.ms-excel"
Response.AddHeader "Content-Disposition", "filename=excelfile.xls"
%>
<table>
<tr>
<td>Category Name</td>
<td>Category Description</td>
</tr>
<tr>
<td>Software</td>
<td>Holds data for software</td>
</tr>
<tr>
<td>Hardware</td>
<td>Hardware related data</td>
</tr>
</table>

However, what i want to do is import only one particular table (tableB) in my code below:

<%
Response.ContentType = "application/vnd.ms-excel"
Response.AddHeader "Content-Disposition", "filename=excelfile.xls"
%>
<table id="tableA" name="tableA">
<tr>
<td>Dont Import</td>
<td>This thing</td>
</tr>
</table>

<table id="tableB" name="tableB">
<tr>
<td>Import</td>
<td>Me</td>
</tr>
</table>

Do you have any suggestions on how i can do this?

Recommended Answers

All 2 Replies

<%
     Response.Charset = "ANSI"
     Response.ContentType = "application/octet-stream"
     Response.ContentType = "application/vnd.ms-excel"
     Response.AddHeader "Content-Disposition", "attachment; filename=complete_services.xls" 
     Response.ContentType = "application/download"
%>

<table>
<tr>
    <th>CODe</th>
<tr>
<tr>
    <td>test</td>
</tr>
</table>
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.