JavaScript doesn't really do that. You could write a JavaScript that pulls a tab delimited text file from a web site using XMLHTTPRequest, and break it down into a sortable, malleable data set. However, getting it into Excel is outside the scope of JavaScript, as it runs in the browser sandbox. Pretty much any server-side or compiled language would let you create an Excel file format. There are even some great libraries for programmatic Excel creation for .NET. (see http://www.aspose.com/ )
2007-03-20 19:01:20
·
answer #1
·
answered by Rex M 6
·
1⤊
3⤋
That's beyond the scope of Javascript. You'll need to use a server side programming language like php or asp for that.
2007-03-20 19:05:56
·
answer #2
·
answered by Anonymous
·
0⤊
2⤋
of course javascript has very limited access to reading, writing, and certainly opening a file in excel! But since you are the second person to ask for this... I put on my thinking cap!
reading is an ajax function, opening a file in excel is an html forms function, connecting them I need a server side program, which I already had!
So it shouldn't be too hard... and it wasn't!
4 lines of perl code,
1 publicly available javascript library for ajax
and a bit for the html and javascript
= 40 lines of code!
down and up!
all this page does it read a tab delimted text file, sort it and download it to an excel spreadsheet!
with the help of a 4 line perl program, and the http://jquery.com library!
#!/usr/bin/perl
use CGI;
my $q = CGI->new;
print "Content-Type: ", $q->param('mimetype') || 'text/plain',"\nContent-Disposition: attachment; filename=",$q->param('filename') || 'any.txt',"\n\n",$q->param('data'),"\n";
this is the data file
2007-03-20 21:18:39
·
answer #3
·
answered by jake cigar™ is retired 7
·
1⤊
0⤋