store the table data in excel file


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting store the table data in excel file
# 8  
Old 03-10-2009
Hello, Thanks for your input.

Here is the code i tried now.

Quote:
${ORACLE_HOME}/bin/sqlplus -s ${ORA_USER}/${ORA_PASSW}@${ORACLE_SID} << EOF > ${FTP_TO}/T_i1_exportdocs_b.xls

set pages 0
set echo off
set ver off
set feed off
set linesize 600
SELECT
'Delivery #'||','||'REGION'||','||'Proforma Invoice'||','||'SONUM'||','||'Export Docs print date'||','||'Export Docs print time'||','||'SLD2NAME'||','||'Frei
ght Fwdr (name)'||','||'Shipto Ctry'||','||'Shipping Point'||','||'Extract Date' from dual;

select
"Delivery #"||','||
REGION||','||
"Proforma Invoice"||','||
SONUM||','||
"Export Docs print date"||','||
"Export Docs print time"||','||
SLD2NAME||','||
"Freight Fwdr (name)"||','||
"Shipto Ctry"||','||
"Shipping Point"||','||
"Extract Date"
FROM t_i1_exportdocs;

exit;
EOF

awk '{sub(/$/,"\r");print}' < T_i1_exportdocs_b.xls > /odsimp/supply_chain/"Global Order Mgmt"/"US Exports"/EXPORT_LOG_SQL/yy.xls

Here is the windows location

/odsimp/supply_chain/"Global Order Mgmt"/"US Exports"/EXPORT_LOG_SQL/yy.xls


Here is the windows file content...


Quote:
Delivery #,REGION,Proforma Invoice,SONUM,Export Docs print date,Export Docs print time,SLD2NAME,Freight Fwdr (name),Shipto Ctry,Shipping Point,Extract Date
0099578218,CALA,2900005302,0011331536,03/09/2009,12:31:40,AVAYA Communication,CON-WAY CENTRAL EXPRESS,MX,CF3N,03/10/2009
0099579232,CALA,2900005303,0011331542,03/09/2009,12:32:14,AVAYA Communication,CON-WAY CENTRAL EXPRESS,MX,CF3N,03/10/2009
# 9  
Old 03-11-2009
Any help is highly appreicated...
# 10  
Old 03-11-2009
I think I know what the problem is. It is your file extension name. You have to make it "csv", not "xls". These files are not really Excel files, so I think Excel is getting confused because it is trying to treat them as such.

Rename T_i1_exportdocs_b.xls to T_i1_exportdocs_b.csv
Rename yy.xls to yy.csv

But you should still run the awk since you are going from Unix to Windows.
# 11  
Old 03-11-2009
SFNYC - Thank you. It works great. Perfect...

Another question, Is it possible to store two different set of data in the same excel file. One set of data should go into one tab. Another set of data should go to another tab in the same excel.. Please let me know. Thanks again and appreciate your help..
# 12  
Old 03-11-2009
SFNYC - Never mind. Business agreed to put in individual files... thanks
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Formatting data to put it in the excel file

Hello, I have a file with the below contents : Policy Name: Backup_bkp Policy Type: Catalog_bkp Active: yes Effective date: 08/07/2013 02:02:12 Mult. Data Streams: no Client Encrypt: no Checkpoint: no Policy Priority: ... (11 Replies)
Discussion started by: rahul2662
11 Replies

2. 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

3. Shell Programming and Scripting

Store table contents in csv file

I need to write a script to store the contents of a table in a csv file I'm using Toad, it's a Oracle database. (5 Replies)
Discussion started by: ladyAnne
5 Replies

4. Shell Programming and Scripting

Store data from dynamic website table

hi everybody, Asking for something that I´m not sure if it´s possible to implement. I hope be clear enough. Well, my issue is that I´m looking how to copy or extract a particular table content of a website. I get the content from a external feed (Iframe format), the content is updated every... (1 Reply)
Discussion started by: cgkmal
1 Replies

5. Shell Programming and Scripting

Sample ksh script for copy the data from excel to database table ?

Hi All, I need to convert the data from excel to database table in sybase. Please provide some sample script.. thanks, Royal. (1 Reply)
Discussion started by: royal9482
1 Replies

6. Shell Programming and Scripting

Copying data from excel file

Hii friends, I am a newbie to unix/shell scripting and got stuck in implementing a functionality.Dear experts,kindly spare some time to bring me out of dark pit :confused:.. My requirement is somewhat wierd,let me explain what i have and what i need to do... 1) there are several excel... (1 Reply)
Discussion started by: 5ahen
1 Replies

7. UNIX for Dummies Questions & Answers

How to store the flat file in an excel sheet

Hi, I need to automate a script. The process in the script is as follows Running the script abc.ksh The report is stored in xyz (flat file) Need to store the flat file content in an excel sheet. Your reply is highly appreciated. Thanks, Karthick (2 Replies)
Discussion started by: karthickrn
2 Replies

8. Shell Programming and Scripting

how to copy data to to excel file

Hi, Can any one tell me how to copy data using shell script to a excel file from text file to other columns of excel file,leaving first column unaffected i.e it should not overwrite data in first column. Say my text file data is: 15-dec-2008 15-dec-2009 16-dec-2008 16-dec-2009 ... (7 Replies)
Discussion started by: tucs_123
7 Replies

9. Shell Programming and Scripting

Help on email data file as excel from unix!!

Hi, I need to email a data in excel sheet from unix using shell scripting.I could able to generate the data file with tab delimiter with extension .xls could able to email it. The problem is when a coulmn with 16 digit number is exported, it is showing in scientific format. Any help in... (1 Reply)
Discussion started by: sparan_peddu
1 Replies

10. Shell Programming and Scripting

How to store Data in a File

I want to read a data from a read command and store it in a file...... Plz send me how I can do that Ex: read val and I want to store this val in a file called temp. (2 Replies)
Discussion started by: krishna_sicsr
2 Replies
Login or Register to Ask a Question