-
Writing to a .xls file using UTL_FILE package
Hi,
Can anyone help me out on writing a .xls file using the UTL_FILE package? I am able to write a .txt and .csv file. But .xls file I am not able to do .. the fields are not coming properly if I use a comma separated approach- all the data are coming in the first column itself.
I was trying the following..
v_buffer := '"'||rec.dept||'","'||rec.students||'"';
UTL_FILE.PUT_LINE(v_fh, v_buffer);
Any help in this regard will be appreciated. Thanks in advance.
Regds,
Abhi
-
You separate with comma when creating csv files, when creating xls files you want to separate with chr(9) like: rec.dept||chr(9)||rec.students
Pablo (Paul) Berzukov
Author of Understanding Database Administration available at amazon and other bookstores.
Disclaimer: Advice is provided to the best of my knowledge but no implicit or explicit warranties are provided. Since the advisor explicitly encourages testing any and all suggestions on a test non-production environment advisor should not held liable or responsible for any actions taken based on the given advice.
-
 Originally Posted by abhi_oracle
Hi,
Can anyone help me out on writing a .xls file using the UTL_FILE package? I am able to write a .txt and .csv file. But .xls file I am not able to do .. the fields are not coming properly if I use a comma separated approach- all the data are coming in the first column itself.
I was trying the following..
v_buffer := '"'||rec.dept||'","'||rec.students||'"';
UTL_FILE.PUT_LINE(v_fh, v_buffer);
Any help in this regard will be appreciated. Thanks in advance.
Regds,
Abhi
when you open in excel you need to specify that it is comma delimited
-
Thanks a lot guys... I tried with chr(9) and it worked ..
-
 Originally Posted by abhi_oracle
I tried with chr(9) and it worked ..
There is a reason for that, in Excel you hit TAB to move to the next cell... chr(9) = TAB
Pablo (Paul) Berzukov
Author of Understanding Database Administration available at amazon and other bookstores.
Disclaimer: Advice is provided to the best of my knowledge but no implicit or explicit warranties are provided. Since the advisor explicitly encourages testing any and all suggestions on a test non-production environment advisor should not held liable or responsible for any actions taken based on the given advice.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|