Hello All!
I am trying to export results from SQL Plus to Excel and using the following super simple code in my SQL Script:
set feedback off markup html on spool on
alter session set nls_date_format='YYYY-MM-DD';
set PAGESIZE 50000
set LINESIZE 10000
set termout off
spool myresults.xls
select fields from tablename;
spool off
set markup html off
The results are exported into an Excel worksheet, but when opening the file, receive the following error:
"The file you are trying to open, 'myresults.xls', is in a different format than specified by the file extension. Verify that the file is not corrupted and is from a trusted source before opening the file. Do you want to open the file now?"
If I click yes, the file opens fine. I save the file to a different location and it appears to be an .xls file, but since it is created using the "markup html on" set command in my SQL, I wonder if there is HTML in the doc?
Any help to be able to create the Excel file this easy way and be able to open it without an error message?
I do not have permissions to change my users' registry settings, etc.
Thanks!
Sunny