/    Sign up×
Community /Pin to ProfileBookmark

Creating Excel Sheets through Javascript

For the past few months I’ve been working on an online tool that basically pulls a ton of information and then keeps that information stored in variables client side. The next step in the tool is to allow for that data which is in variables client side to be exported into a customized excel spreadsheet.

I’ve done a lot of research on doing this and it appears the approach to take is through ActiveX controls in Javascript.

However the simple code segment:

[CODE]
function createSheet()
{//BEGIN createSheet
var xls;
xls = new ActiveXObject(“Excel.Application”);

xls.Visible = true;
}//END createSheet
[/CODE]

Throws an ActiveXObject is not defined error. Why is it a problem creating an excel application? Any ideas?

Thanks!

to post a comment
JavaScript

4 Comments(s)

Copy linkTweet thisAlerts:
@felgallDec 05.2008 — ActiveX is only available from JScript which is the Internet Explorer equivalent to JavaScript. All other web browsers run JavaScript and do not have activeX.
Copy linkTweet thisAlerts:
@Farel321authorDec 05.2008 — Darn. Is there another way of creating spreadsheets (.xls, not .csv)?
Copy linkTweet thisAlerts:
@rnd_meDec 05.2008 — no.

but csvs and html tables will open in excel as worksheets...

other browsers can do a fake document open, sending the data to excel by opening an excel mime-type document from a javascript-built dataURI.
Copy linkTweet thisAlerts:
@Farel321authorDec 08.2008 — Well that's a drag! I guess I'll just have to revert to .csv files. Thank you everyone for your input!
×

Success!

Help @Farel321 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 5.21,
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: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

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

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...