Toad World® Forums

Exporting SQL results to Excel and other formats without using the menu

I am using SQL Navigator 5.5.0.713. I want to write a series of SQL queries and direct the output to Excel. I can do this by running the Query, right clicking on the output window, and exporting. However, this requires me to manually intervene after each statement. Is there a mechanism I can use to automatically redirect the output to a file and then continue on to my next statement? In other words, I’d like to do something like this…

select * from dual;export to C:\aaa.xls format excel;

select sysdate from dual;export to c:\aaa.html format html;

Unfortunately, we don’t have anything like that in 5.5 or even 6.2. I will raise an enhancement request for it.

Cheers
Gwen

I have an alternative suggestion. What if we instead extend the syntax of SQL*Plus’ SPOOL statement to include the format for query data? This way we don’t have to change our parser (which is difficult and risky), just handle SPOOL differently. What do you think?

Regards,
Roman

Sounds like SQL Plus support is a feature of 6.x, which I guess if you added this feature that would work. However, SQL Navigator is such a good tool that I’d rather work within it instead of having to branch to a SQL Plus interface. I can understand why you wouldn’t want to change the parser, but I would think that a keyword such as “export” or “output”, directly following the command delimiter (";" or “/”) for the previous command, would be a fairly straightforward piece of code.But yes, the SPOOL extension option would work, assuming you can get it to create nicely formatted Excel or tab delimited files.Thanks Roman and Gwen for your quick responses.

Thanks for getting back to us. Please be aware that because this is not an urgent issue it may take a while before it get attended to.

Gwen

I am trying to export to excel and was wondering if this upgrade has been completed?

Looking for the actual code, not the wizard output.

Thanks!

Hi Shanah,

Sorry that we could not make this request in the release yet. We are still trying to work through the list of other CRs for the next release v6.6.

We will let you know later if we could manage to get the changes for this request in the next release. The changes we would provide for this was to have a new option/preference to experform export to file straight away after sucessful execution of each statement.

Thanks and regards,
Bruce