![]() |
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Add multiple .csv files as sheets to an excel file in unix. | libin4u2000 | Shell Programming and Scripting | 2 | 01-20-2009 11:20 PM |
| How to combine different Excel sheets into a single work book using UNIX | jagadish99 | Shell Programming and Scripting | 3 | 08-27-2008 07:23 PM |
| How to format excel sheets in UNIX?? | Vijay06 | Shell Programming and Scripting | 2 | 05-16-2007 10:01 AM |
| Multiple excel work sheets through UNIX | puspendu | Shell Programming and Scripting | 1 | 05-03-2006 05:28 AM |
| creating more than 2 excel sheets in C | manceryder | High Level Programming | 7 | 12-20-2005 06:10 PM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
Sending SQL Queries output to different Excel sheets
Hi,
I need your help in sedning sql queries output to different excel sheets. My requirement is like this: Query1: Select name from table1 where status = 'Complete' Query2: Select name from table1 where status = 'Failed' Query3: Select name from table1 where status = 'Ignored' When i execute these queries, i want output of Query1 to be on sheet1 and output of query2 to be on sheet2 and output of query3 on sheet3 of an excel file. Not sure whether it can be achieved using sqlplus. Could some one please help me in this. Thanks . Parvathi |
|
||||
|
I have being doing it in sybase using perl.
use Spreadsheet::WriteExcel; use Spreadsheet::WriteExcel::Worksheet; use Sybase: Blib;my @results; my $sql = "select *" my $dbh = Sybase: Blib->new($user , $passwd , $server);if (defined $dbh) { @results = $dbh->nsql($sql , "HASH"); } else { print "No DB Connection found for $server"; } my $ebook = Spreadsheet::WriteExcel->new(file); my $esheet = $ebook->addworksheet($title); my $format = $ebook->addformat(); my $formatheader = $ebook->addformat(); my $formatcolumn = $ebook->addformat(); $formatheader->set_size(20); $formatheader->set_font('Verdana'); $formatheader->set_color('brown'); $formatheader->set_align('center'); $formatheader->set_bold(); $formatheader->set_merge(); $formatcolumn->set_size(10); $formatcolumn->set_font('Verdana'); $formatcolumn->set_color('navy'); $formatcolumn->set_align('center'); $formatcolumn->set_bold(); $formatcolumn->set_italic(); $format->set_color('black'); $format->set_font('Verdana'); $format->set_align('center'); $esheet->write_blank(0,0,$formatheader); $esheet->write_blank(0,1,$formatheader); $esheet->write_blank(0,2,$formatheader); $esheet->write_blank(0,3,$formatheader); $esheet->set_column(0, 2, 25,$formatheader); $esheet->set_column(2, 0, 25,$formatcolumn); $esheet->set_column(2, 1, 25,$formatcolumn); $esheet->set_column(2, 2, 25,$formatcolumn); $esheet->set_column(2, 3, 25,$formatcolumn); $esheet->set_column(2, 4, 25,$formatcolumn); my $o = 0; foreach my $values (@results) { $esheet->set_column(3,$o, 25,$format); $esheet->write($i,0,"$values->{'Branches_ShortName'}",$format); $esheet->write($i,1,"$values->{'Portfolios_ShortName'}",$format); $esheet->write($i,2,"$values->{'Portfolios_Name'}",$format); $esheet->write($i,3,"$values->{'Folders_ShortName'}",$format); $esheet->write($i,4,"$values->{'Folders_Name'}",$format); $i++; $o++; } $ebook->close(); |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|