Sponsored Content
Top Forums Shell Programming and Scripting Sending SQL Queries output to different Excel sheets Post 302320431 by dinjo_jo on Thursday 28th of May 2009 03:44:07 AM
Old 05-28-2009
I have being doing it in sybase using perl.

use Spreadsheet::WriteExcel;
use Spreadsheet::WriteExcel::Worksheet;
use Sybase:SmilieBlib;

my @results;


my $sql = "select *"
my $dbh = Sybase:SmilieBlib->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();
 

10 More Discussions You Might Find Interesting

1. Programming

creating more than 2 excel sheets in C

Hi, I have a question about using C to write excel file. There is a way to write into a sheet into a file excel, like this: FILE * File; pMyFile = fopen("test.xls", "w+"); fprintf(File, "\n\n"); /* go to the row 2 of the column A*/ fprintf(File, "%s", "Hi pippo!"); /* write... (7 Replies)
Discussion started by: manceryder
7 Replies

2. Shell Programming and Scripting

Multiple excel work sheets through UNIX

Hi, There is this requirement to create multiple work sheets in an MS Excel file through UNIX. We normally can create one work sheet in unix by either tab or comma delimiting and appending .xls or .csv to the file name, but can we create multiple work sheets. Regards, Puspendu (1 Reply)
Discussion started by: puspendu
1 Replies

3. Shell Programming and Scripting

How to format excel sheets in UNIX??

Hi, I have generated an excel sheet using a shell script. i have converted the output text file to an excel and got the desired output. However, in a particular column in the excel the values of the numbers start with 0. e.g. 078393343, 00342442, etc. But, in the resulting excel I get as... (2 Replies)
Discussion started by: Vijay06
2 Replies

4. Shell Programming and Scripting

Run SQL queries in DB2 and output to file

Hi, I new to Unix and scripting. Following is my requirement. Can someone tell me whether its possible or not. Also please let me know how to proceed further if this is possible. List of queries are stored in a file. For example, I have to run a query like this: Select * from &XYZ where... (0 Replies)
Discussion started by: simhasuri
0 Replies

5. Shell Programming and Scripting

Help to get the Output of PL/SQL procedure In a Excel or Text File

Hi, Could anyone please guide me to get the output of the PL/SQL procedure in a Excel file or Text File... Thanks (1 Reply)
Discussion started by: funonnet
1 Replies

6. Shell Programming and Scripting

create separate files from one excel file with multiple sheets

Hi, I have one requirement, create separate files (".csv") from one excel file(xlsx) with multiple sheets. These ".csv" files are my source files. So anybody please suggest me the process. Thanks in Advance. Regards, Harris (3 Replies)
Discussion started by: harris
3 Replies

7. Shell Programming and Scripting

Write two csv files into one excel with multiple sheets

I have requirement to write two CSV files to one single excel with multiple sheets. Data present in the two files should sit in excel as different sheets. How can we achieve this using shell script? 1.csv 2. csv 1,2,3,4 5,6,7,8 XXXXX YYYYY Res.excel 1.csv data... (1 Reply)
Discussion started by: duplicate
1 Replies

8. Shell Programming and Scripting

Help with storing the output of multiple sql queries to a file

Hi All, I have a file queries.txt as follows : SELECT COLUMN1 FROM SCHEMA2.TABLE1 MINUS SELECT COLUMN1 FROM SCDEMA2.TABLE2; SELECT COLUMN2 FROM SCHEMA2.TABLE1 MINUS SELECT COLUMN2 FROM SCDEMA2.TABLE2; SELECT COLUMN3 FROM SCHEMA2.TABLE1 MINUS SELECT COLUMN3 FROM SCDEMA2.TABLE2; SELECT... (2 Replies)
Discussion started by: SriRamKrish
2 Replies

9. Shell Programming and Scripting

Script to generate Excel file or to SQL output data to Excel format/tabular format

Hi , i am generating some data by firing sql query with connecting to the database by my solaris box. The below one should be the header line of my excel ,here its coming in separate row. TO_CHAR(C. CURR_EMP_NO ---------- --------------- LST_NM... (6 Replies)
Discussion started by: dani1234
6 Replies

10. Shell Programming and Scripting

Storing multiple sql queries output into variable by running sql command only once

Hi All, I want to run multiple sql queries and store the data in variable but i want to use sql command only once. Is there a way without running sql command twice and storing.Please advise. Eg : Select 'Query 1 output' from dual; Select 'Query 2 output' from dual; I want to... (3 Replies)
Discussion started by: Rokkesh
3 Replies
EBOOK-META(1)							      calibre							     EBOOK-META(1)

NAME
ebook-meta - part of calibre SYNOPSIS
ebook-meta ebook_file [options] DESCRIPTION
Read/Write metadata from/to ebook files. Supported formats for reading metadata: azw, azw1, cbr, cbz, chm, epub, fb2, html, imp, lit, lrf, lrx, mobi, odt, oebzip, opf, pdb, pdf, pml, pmlz, prc, rar, rb, rtf, tpz, txt, zip Supported formats for writing metadata: azw, azw1, epub, lrf, mobi, pdb, pdf, prc, rtf, tpz Different file types support different kinds of metadata. If you try to set some metadata on a file type that does not support it, the metadata will be silently ignored. Whenever you pass arguments to ebook-meta that have spaces in them, enclose the arguments in quotation marks. OPTIONS
--version show program's version number and exit -h, --help show this help message and exit -t, --title Set the title. -a, --authors Set the authors. Multiple authors should be separated by the & character. Author names should be in the order Firstname Lastname. --title-sort The version of the title to be used for sorting. If unspecified, and the title is specified, it will be auto-generated from the title. --author-sort String to be used when sorting by author. If unspecified, and the author(s) are specified, it will be auto-generated from the author(s). --cover Set the cover to the specified file. -c, --comments Set the ebook description. -p, --publisher Set the ebook publisher. --category Set the book category. -s, --series Set the series this ebook belongs to. -i, --index Set the index of the book in this series. -r, --rating Set the rating. Should be a number between 1 and 5. --isbn Set the ISBN of the book. --tags Set the tags for the book. Should be a comma separated list. -k, --book-producer Set the book producer. -l, --language Set the language. -d, --date Set the published date. --get-cover Get the cover from the ebook and save it at as the specified file. --to-opf Specify the name of an OPF file. The metadata will be written to the OPF file. --from-opf Read metadata from the specified OPF file and use it to set metadata in the ebook. Metadata specified on the command line will over- ride metadata read from the OPF file --lrf-bookid Set the BookID in LRF files SEE ALSO
The User Manual is available at http://calibre-ebook.com/user_manual Created by Kovid Goyal <kovid@kovidgoyal.net> ebook-meta (calibre 0.6.53) July 2010 EBOOK-META(1)
All times are GMT -4. The time now is 07:53 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy