By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,011 Members | 2,967 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,011 IT Pros & Developers. It's quick & easy.

Try to open data into excel from perl

P: 1

I'm trying to open some data I've collected in my Perl DBI script - in excel.
I'm using Javascript function to try and open the data in execl - without
trying to do a SaveAs first. So I have data all formatted in a Variable and
I want this to open in excel - once I get the data to open i n excel - its then
the use can review the data and then save as a file to the PC etc...
below is my function
Expand|Select|Wrap|Line Numbers
  1. function openTo Excel(inputVar)
  2. {
  4.     SaveFrame.document.charset="iso-8859-1";
  5.     SaveFrame.document.write(inputVar)
  6.     SaveFrame.document.close()
  7.     SaveFrame.focus()
  8.     SaveFrame.document.execCommand('Open', false, inputVar)
  9. }
The OPEN - pops up a dialog box asking me to give it a file to open - But what I'm doing is sending it data to open - and I can't seem to find the right commands to fo this. I just what to open the data in excel - not do a "SaveAs" first. Can anyone help?

Jan 9 '08 #1
Share this Question
Share on Google+
2 Replies

Expert 100+
P: 971
This appears to be a JavaScript question rather than Perl. Moving thread to JavaScript forum.

Jan 9 '08 #2

Expert Mod 15k+
P: 16,027
You can use something like this:
Expand|Select|Wrap|Line Numbers
  1. var excel = new ActiveXObject("Excel.Application");
  2. excel.Visible = true;
  3. var wb = excel.Workbooks.Add();
  4. var sheet = wb.ActiveSheet;
  5. sheet.Cells(1, 1).Value = "Set first cell to some value";
Note that this would only work in IE. If that's not what you want, generate the Excel file on the server-side.
Jan 10 '08 #3

Post your reply

Sign in to post your reply or Sign up for a free account.