/    Sign up×
Community /Pin to ProfileBookmark

HTML to Excel

I have a web page with HTML Table with roster information. I want to have a link at the bottom of the html page that will take the data from the table and export to Excel.

Is this possible using JavaScript? Any ideas?

Thanks.

to post a comment
JavaScript

4 Comments(s)

Copy linkTweet thisAlerts:
@FCBSep 16.2004 — i would make the excel sheet yourself and make it available for download, otherwise, tell them to get IE and use the export feature on the right click, lol!
Copy linkTweet thisAlerts:
@mynoxauthorSep 16.2004 — Actually that is what we are currently doing. However, their is a training issue with our users.

The right click feature was also talked about but is not an option.

Does anyone have any suggestions how this could be done with JavaScript?


Thanks again.
Copy linkTweet thisAlerts:
@FangSep 16.2004 — You can copy and paste the table directly to Excel.
Copy linkTweet thisAlerts:
@baconbuttySep 16.2004 — In Internet Explorer it is possible to do this by automation.

Google on "automation of Excel" or something.

Excel comes with an ActiveXObject, that lets you automate it from script.

I.e.

var oExcelObject=new ActiveXObject("Excel.Sheet");

From this you can access all of the macro functions provided by Excel, e.g. you could iterate through your HTML table and pass the values directly to the Excel cells.

To learn more about Excel automation, and the ActiveXObjects available, look at the Excel Visual Basic helpfiles that come with Excel. Given that Excel has VB as a macro language, their documentation and examples are in VB, but it is fairly easy to translate into javascript.

I will have a look for an old script I have on this.
×

Success!

Help @mynox spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 6.2,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @meenaratha,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,

tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,
)...