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

Writing from an Oracle Database to an Excel File.

P: 6
I am really new with Perl and I am trying to write data from an Oracle database to an Excel Spreadsheet simply by clicking on a link. I have read over CPAN Spreadsheet::WriteExcel and I really am not sure where to even begin. Do I have to write a .pl page for this Write Excel or can I write to an Excel file from an ASPX or ASP page? Also will it be one page that I create or multiple pages?
I'm assuming this task shouldn't be too difficult, but I can't even wrap my head around where to begin. Any direction at all would be great or any code snippets to get me started would be appreciated as well.
Thanks!
Apr 5 '07 #1
Share this Question
Share on Google+
3 Replies


tifoso
P: 41
Not clear if u want to do it on the fly or write and actual file, it sounds like reading Oracle is no issue., writing to a file -> quickest way write to a comma separated field file and named it with extension CSV. XL will read it fine.

You can do it cleaner from ASPX with an object but since this is a perl section my guess is you want perl to do it.

Cheers

Becker
Apr 11 '07 #2

P: 6
Whatever is the easiest way to accomplish this task is what I'm interested in.
I have a table conferences and in this table I have 4 columns (1,2,3,4) that I want to write to a csv, xls, tab delimited. What I'm hoping to happen is for a person to click on a link that says "Click here for data" and when they click a file is created which they can then view in Excel. I understand that .NET would be so much easier unfortunately it has to be done from a PERL page.
Any suggestions?
Thanks!

Not clear if u want to do it on the fly or write and actual file, it sounds like reading Oracle is no issue., writing to a file -> quickest way write to a comma separated field file and named it with extension CSV. XL will read it fine.

You can do it cleaner from ASPX with an object but since this is a perl section my guess is you want perl to do it.

Cheers

Becker
Apr 11 '07 #3

P: 6
This is what I currently have and it is not working. What might I be missing or am I overlooking something altogether?
Thanks,
Katie

#!/afs/isis.unc.edu/pkg/perl-582/bin/perl

use Spreadsheet::WriteExcel::FromDB;

use Spreadsheet::WriteExcel::FromDB::Query;

my $dbh = DBI->connect("dbi:Oracle:oracle.unc.edu",'username','p assword',
{ RaiseError => 0, AutoCommit => 0, LongReadLen => 16384 } ) ||
&do_error("Logging in to database: $DBI::errstr");

$query = q{'SELECT dateadded, totalpeople, miles, totalsaved FROM OWNER.Conference ORDER BY dateadded'};
my $ss = Spreadsheet::WriteExcel::FromDB->read($dbh, $query);

print $ss->write_xls('savings.xls');
Apr 11 '07 #4

Post your reply

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