Shell script to spool sql query output in single excel file but in two separate work sheet

I have written shell script which connect to Oracle DB and spool output into excel (.csv / .xls). This works perfectly fine to fetch data in single excel file.
I want to enhance my script which will connect to DB and execute 2 different queries which will spool the output into single excel file , but in 2 separate work sheet.
Is there any way to achieve this from script ?

I am not aware of Oracle being able to output EXCEL workbooks, i.e. binary files. What it can do, and what you already deploy, is outputting .csv style files, if need be with different field / column separators. But each .csv files is one work sheet only. So - make Oracle output two files, one for each query, and combine them reading them individually into a work book.

Tom Kite wrote owa_sylk which writes to .xls format files. It is an Oracle package, scrape it from here:

Ask TOM "Owa_sylk utility"

2 Likes

Few Example from archives though old post

Oracle

Mysql

1 Like