Benthic Software Blog

Tips for using Oracle and our products

How to export Oracle data to Excel.

Golden (our product for Oracle Databases) and GoldSqall (our product for Oracle, PostgreSQL, MySQL, Firebird, and others) both include several options for exporting data to Excel. These options are as simple as a single menu choice to export the currently displayed data to Excel, to complex scripting and command-line options to automate exports and to merge data into existing Excel documents. We will discuss them below from the simplest case to the more complex.

Simple example of exporting to Excel:

Once a query or statement is run that displays data, that data can be exported directly to Excel.

Just clicking "Export to Excel" from the "Results" menu will open Excel and show the data in a new workbook:

Advanced example of exporting to Excel:

As above, once a query or statement is run that displays data, that data can be exported. If you don't want to export all the data shown in the data grid, first selecte just the data you'd like to export. Now click the "Advanced Export..." item on the "Results" menu.

Clicking "Advanced Export..." from the "Results" menu will display the advanced export window. Click on "Excel" under "Spreadsheet Formats" to make an advanced Excel export:

Use the "Data to export" options to choose what data will be exported. The "Include headers" option to include a header row with the column names with the data.

Excel export options:
Template Filename:

Use Template Filename to put the data into an existing Excel file instead of a new one. If this option is empty than a new Excel document will be created.

Worksheet Name:

The worksheet name to put the data into, a new worksheet will be created with this name if it doesn't already exist.

Starting Cell:

The starting cell to put the data. The default is cell "A1" which is the top left cell. Combined with the other options this allows inserting data into an existing spreadsheet exactly where it's needed.

Include SQL:

This option can be used to include the query text into the spreadsheet along with the data. Options are Above, Below, and on a separate sheet.

Scripting an Export

Simple or more advanced exports can also be part of a script. Just include your query first, and the next statement should be "Export excel" along with any arguments or option switches. See the help file for your product to find the full syntax of the Export command as well as command-line options for running scripts.