Link to home
Start Free TrialLog in
Avatar of hansus
hansus

asked on

Export part of webpage to Excel

Hi Experts,
How can we export PART of a webpage to Excel.  
I have lots of webpages where part of my webpage are reports.

I have knowledge of coding it in ASP and to generate a separate excel file, but my reports are complex and I have lots of reports, and I may be forced to modify the formats very often.

Can some one suggest me different ways of exporting part of a webpages to excel.

Thanks in Advance
-Ratnam
ASKER CERTIFIED SOLUTION
Avatar of bugs021997
bugs021997
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
There is a tricky way for solving your problem. If you create a HTML table which holds all the data you want to export as an excel file by writing an ASP page, and if you put the proper headers to your ASP page, your HTML table can be downloaded as an Excel file. And this excel file is nicely handled by MS Excel.

You can try the code below:

 
<%
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>
 
Avatar of [ fanpages ]
[ fanpages ]

Hi,

Is this request for an end-user, or for your internal use?

Would you be opposed to having a browser add-in (extension) that allows you to select one or more cells of a table for then export to the clipboard, or to another format such as an MS-Excel file?

Which browser will you be viewing your resultant pages with, btw?

BFN,

fp.
hansus,

Recently, I had the need to embark on the painful journey of extracting data from a web page, because Excel's in-built "Import External Data" does not allow for updating information from behind a username/password protected web page (or at least the web site I was using).

After a number of painful days, exploring every possibility of interfacing with a web page, e.g., Wscript shell, sql query, etc., having to deal with Javascript elements, and eventually having to learn the underlying structure of the HTML standard, I was able to extract the required data from utilising the "innertext" or "innerHTML" property on the relevant table from the web page's raw data.

If you are able to have some consistent information about the table containing the information of interest, then you can use VBA to extract the necessary data on the fly.  For example, if you know that:

The text found in the nth cell of the report table will be, say "Description" (even if this changes from page to page); or
The table will be the nth table on the page; or
There is some other web page property in connection with your data that you can search the web page source data for.

If this seems to fit the bill, then we'd need to have some more details on the report and web page structure to start.  Ideally, it would be a link to an actual page which shows the structure plus data (replace sensitive data with dummy data).

Hope this helps.
Scott

Avatar of hansus

ASKER

bugs,
thanks alot for the help...
I have done with your code but this following link has sorted all my issues
http://support.microsoft.com/default.aspx?scid=kb;en-us;Q271572

thanks agiain for your timely help
-hansus