Export to excel from oracle sql developer

Do you find it difficult to export your data from Oracle SQL Developer to excel and CSV format? Have you ever just banged your hands at the keyboard, closed your eyes, and thought “Is it supposed to be this hard?”. Well, the answer is NO. This post will guide you step by step with necessary screenshots through the whole process of Oracle SQL Developer export to excel & CSV format.

It’s every developer’s dream to be able to manipulate and convert their data into any format. Often this takes a lot of effort and resources just to get the already painstakingly gathered data to the desired format. One such example is exporting your data from Oracle SQL Developer to excel and CSV format. 

Introduction To Oracle SQL Developer

Oracle offered a database IDE in the form of Oracle SQL Developer. It supports the graphical user interface i.e. any user or administrator can perform the database activities in fewer clicks. It simplifies Oracle database development and management on a traditional and cloud-based platform. They also provide export and import utilities to their users. You can explore more about the functionalities of Oracle here.

Oracle’s main objective is to save the user’s time and effort in every possible way. So, the process of Oracle SQL Developer export to excel and CSV format should be a painless and ephemeral task. Let’s see how you will conquer this feature of Oracle.

Oracle SQL Developer Export to Excel: Oracle SQL

Image Source: www.logo.wine/logo

Hevo offers a faster way to move data from databases such as Oracle; SaaS applications and 100+ other data sources into your data warehouse to be visualized in a BI tool. Hevo is fully automated and hence does not require you to code.

Get Started with Hevo for Free

Let’s look at the benefits of using Hevo:

  • Secure Data Transfer: Hevo offers two-factor authentication and end to end encryption, which makes sure that the data movement is safe and secure.
  • Fully-Automated: Hevo platform requires minimal maintenance and management. This fully automated service is a wise choice for anyone.
  • Auto Mapping: It can automatically create the schema by mapping the data from the source to the destination schema. Hevo takes care of the mapping even when there are changes in the latter stage.
  • Scalability: Hevo can handle millions of records per minute without any latency. The data pipelines are scaled according to the requirement.
  • Friendly Live Support: Hevo team is ready to offer a helping hand at any time through emails, chat, and calls. 

Sign up here for a 14-Day Free Trial!

Download the Ultimate Guide on Database Replication

Download the Ultimate Guide on Database Replication

Download the Ultimate Guide on Database Replication

Learn the 3 ways to replicate databases & which one you should prefer.

Let’s see what you will cover here:

  • Prerequisites
  • Steps For The Exporting Process

Prerequisites

  • Oracle SQL Developer installed on your system.
  • Knowledge about RDBMS.

Steps For The Exporting Process

The steps involved in creating an excel and CSV file from the data in Oracle SQL Developer are listed below:

  1. Connect Your Database
  2. Run Your Query
  3. Export Your Data
  4. Select Your Desired Format
  5. Use Your Data In The Desired Format

Step 1: Connect Your Database

Connect to your database in Oracle SQL Developer by using the correct credentials of your database. This database contains the data that needs to be exported to an Excel or CSV file.

Oracle SQL Developer home

Image Source: www.docs.oracle.com/en/cloud

Step 2: Run Your Query

Write the following command in the SQL worksheet and execute it by clicking the run button on the top left corner of the worksheet. You can also use any other query to get your desired output.

SELECT * FROM ACCOUNTS;

Run Query

Image Source: www.youtube.com

Step 3: Export Your Data

Right-click on the query result and select Export from the drop-down menu.

Oracle SQL Developer Export

Image Source: www.stackoverflow.com/questions

Step 4: Select Your Desired Format

In the Export Wizard, select “excel 2003+ (xlsx)” for excel versions above 2003 or “excel 95-2003 (xls)” for excel version between 95 and 2003 or “csv” in the format, and then determine your destination location. Click “Next” and then “Finish”.

Oracle SQL Export Wizard

Image Source: www.docs.oracle.com/cd

Step 5: Use Your Data In The Desired Format

Finally, you can go to your destination location and open the exported data in the specified format.

Conclusion

You have learned the process of Oracle SQL Developer export to excel and CSV format. The data that you have exported is usually needed for backup or to transfer that data to another database or a data warehouse. Extracting complex data from a diverse set of data sources can be a challenging task and this is where Hevo saves the day!

Visit our Website to Explore Hevo

Hevo, a No-code Data Pipeline helps you transfer data from Oracle SQL Developer in a fully automated and secure manner without having to write the code repeatedly. Hevo, with its secure integrations with 100+ sources & BI tools, allows you to export, load, transform, & enrich your data & make it analysis-ready in a jiffy.

Want to take Hevo for a spin? Sign Up for a 14-day free trial and experience the feature-rich Hevo suite first hand. You can also have a look at the unbeatable pricing that will help you choose the right plan for your business needs.

Let us know about your experience of Oracle SQL Developer export to Excel and CSV in the comment section below. 

No-code Data Pipeline for Oracle

Do you need to export your query output to an Excel file in SQL Developer?

If so, you’ll see the complete steps to accomplish this goal.

Step 1: Run your query

To start, you’ll need to run your query in SQL Developer. You can run any query based on your needs.

Step 2: Open the Export Wizard

Once you’re done running the query in SQL Developer, you’ll see the query output at the bottom of your screen.

Right-click on any cell on the query results, and then select the ‘Export…‘ option from the drop down menu.

You’ll then see the Export Wizard.

Step 3: Select the Excel format and the location to export your file

Now you’ll need to:

  1. Select the Excel format from the drop-down list. You can choose the xlsx format for recent versions of Excel, or the xls format for previous versions of Excel
  2. Click on the ‘Browse…‘ button to select the location where the Excel file will be saved
  3. Press on the ‘Next >‘ button once you are done

Step 4: Export the query output to Excel

For the final step, click on the ‘Finish‘ button to export the query output to Excel.

Conclusion

You just saw how to export your query output to Excel in SQL Developer. You can choose to export your query results to either the xlsx format for newer versions of Excel, or the xls format for previous versions of Excel.

If you need to export your query output to a CSV file, you may then check the following guide that explains the steps to export your query results to CSV in SQL Developer. Alternatively, you may apply spool to accomplish the same goal.

I have a small project where data from Oracle SQL Developer needs to be exported to Excel (using commands rather than tools in SLQ Developer), then create a graph.
Using «spool» I can export to csv fine (but cant make a graph in csv) but when I try to export to xlsx it corrupts the whole excel sheet saying

"Excel cannot open the file "ExcelFile.xlsx" because the file format or file extention 
       is not valid. Verify that the file has not been corrupted and that the 
       file extension mathces the format of the file."

Here is the code I used in SQL Developer.

spool FileLocationExcelFile.xlsm
SELECT * FROM Table;
spool off;

Is there any way I can stop the data from becoming corrupted or is there another way to export data to a .xlsx file?

thebluephantom's user avatar

asked Jun 23, 2017 at 15:22

IAmRapson's user avatar

5

Nooooooo.

set sqlformat csv
spool c:file.sql
select * from table;
spool off;

then open the file in excel.

OR

Run your query interactively.

Right click on the grid, Export > XLSX. Open the file.

Spool only writes the query output to the file, it doesn’t look at the file extension and figure out HOW to write the output at that point.

So you either have to code it yourself via the query, or use one of the format outputs we support

SET SQLFORMAT
  CSV
  JSON
  DELIMITED
  XML
  HTML
  INSERT
  LOADER

Use ‘help set sqlformat’ for help.

answered Jun 23, 2017 at 22:06

thatjeffsmith's user avatar

thatjeffsmiththatjeffsmith

19.8k4 gold badges38 silver badges115 bronze badges

1

Hi sql developer from what I know for exporting is using sqlplus(code is same) so perhabs there are other ways but this one should be good enough

I would try changing first line to look like this:

spool ExcelFile.xls

Probably you also need to turn on

SET MARKUP HTML ON

http://www.orahow.com/2015/09/spool-sqlplus-output-to-excel-format.html

Anyway there is workaround — you can just generate .CSV file and then open it in excel and save as .xlsx file

answered Jun 23, 2017 at 15:27

kpazik's user avatar

kpazikkpazik

1752 silver badges11 bronze badges

1

I was also facing the same problem then applied below code and it exported successfully..

import xlsxwriter
from xlsxwriter import Workbook
import cx_Oracle
import datetime
from datetime import date

dsn_tns = cx_Oracle.makedsn('HOST', 'PORTNO', sid='BGRDB') 
    
db = cx_Oracle.connect(user=r'username', password='password', dsn=dsn_tns)
cursor = db.cursor()

workbook = xlsxwriter.Workbook('C:/Path/outfile.xlsx')
sheet = workbook.add_worksheet()


cursor.execute("select * from TABLENAME")
for r, row in enumerate(cursor.fetchall()):
         for c, col in enumerate(row):
                sheet.write(r, c, col)

workbook.close()
cursor.close()

answered Jun 29, 2020 at 15:11

Nishika Gangrade's user avatar

The export function for query result is not so obvious for developers to find out. In this post, I will show how to export query result as a Excel file.

Show Query Result as Grid

To show the query result in a grid table, you have to use F9 or Ctrl+Enter to format query result in grid.

SQL Developer Query Result

SQL Developer Query Result

Right Click Mouse and Export

Move your cursor over anywhere on the grid and right click the mouse, you will see Export option.

SQL Developer Query Result - Export

SQL Developer Query Result — Export

Export Entire Table

If the data you want to export is a table, not a query result, you can directly right-click on the table and select Export in the menu.

SQL Developer - Table Menu - Export

SQL Developer — Table Menu — Export

Select Export Format

SQL Developer showed Export Wizard window for interaction. Although there’re many export types for us to select, we chose Excel format in this case.

SQL Developer Query Result - Export Format - Excel (.xls)

SQL Developer Query Result — Export Format — Excel (.xls)

Select Text Encoding

I chose UTF-8 in order to match the database encoding.

SQL Developer Query Result - Export Encoding - UTF-8

SQL Developer Query Result — Export Encoding — UTF-8

Customize Filename

If you want to change the path, you can click Browse to navigate and choose a right directory to place.

SQL Developer Query Result - Export File Name - Browse

SQL Developer Query Result — Export File Name — Browse

Review Export Job Before Executing

You can expand all options to see the content of the export job.

SQL Developer Query Result - Export - Summary

SQL Developer Query Result — Export — Summary

Check Content of Excel File

We open the Excel file in an application, so they can be viewed its content below.

SQL Developer Query Result - Export - Excel File Content

SQL Developer Query Result — Export — Excel File Content

That’s it!

Next, we can restore the Excel data back into table by importing data in SQL Developer whenever needed.

Содержание

  1. Export Query Output to Excel in SQL Developer
  2. Steps to export query output to Excel in SQL Developer
  3. Step 1: Run your query
  4. Step 2: Open the Export Wizard
  5. Step 3: Select the Excel format and the location to export your file
  6. Step 4: Export the query output to Excel
  7. Conclusion
  8. Oracle SQL Developer To Excel & CSV: 5 Steps To Move Data Conveniently
  9. Table of Contents
  10. Introduction To Oracle SQL Developer
  11. How SQL Developer Export to Excel
  12. Export to Excel
  13. Show Query Result as Grid
  14. Right Click Mouse and Export
  15. Export Entire Table
  16. Select Export Format
  17. Select Text Encoding
  18. Customize Filename
  19. Review Export Job Before Executing
  20. Check Content of Excel File
  21. Tutorial: Exporting Query Results
  22. Exporting Data from a Grid
  23. Exporting Data from a Script
  24. Product Managers who Blog..about their Products
  25. Quick Tip: Spooling to ‘Excel’
  26. Related Posts
  27. Oracle REST APIs & Query Parameter Examples using EMPLOYEES
  28. Using SQLcl & Liquibase DIFF command to compare schemas
  29. Export your Oracle Autonomous Database using Data Pump
  30. SQL Developer Web: Cleaning up data loading error logs
  31. Data Pump & SQL Developer Web for Oracle Autonomous Database
  32. ORDS & SQL Developer Web 22.4.2 – Self Service Schemas
  33. 23 Comments

Export Query Output to Excel in SQL Developer

Do you need to export your query output to an Excel file in SQL Developer?

If so, you’ll see the complete steps to accomplish this goal.

Steps to export query output to Excel in SQL Developer

Step 1: Run your query

To start, you’ll need to run your query in SQL Developer. You can run any query based on your needs.

Step 2: Open the Export Wizard

Once you’re done running the query in SQL Developer, you’ll see the query output at the bottom of your screen.

Right-click on any cell on the query results, and then select the ‘Export…‘ option from the drop down menu.

You’ll then see the Export Wizard.

Step 3: Select the Excel format and the location to export your file

Now you’ll need to:

  1. Select the Excel format from the drop-down list. You can choose the xlsx format for recent versions of Excel, or the xls format for previous versions of Excel
  2. Click on the ‘Browse…‘ button to select the location where the Excel file will be saved
  3. Press on the ‘Next >‘ button once you are done

Step 4: Export the query output to Excel

For the final step, click on the ‘Finish‘ button to export the query output to Excel.

Conclusion

You just saw how to export your query output to Excel in SQL Developer. You can choose to export your query results to either the xlsx format for newer versions of Excel, or the xls format for previous versions of Excel.

If you need to export your query output to a CSV file, you may then check the following guide that explains the steps to export your query results to CSV in SQL Developer. Alternatively, you may apply spool to accomplish the same goal.

Источник

Oracle SQL Developer To Excel & CSV: 5 Steps To Move Data Conveniently

Table of Contents

Do you find it difficult to export your data from Oracle SQL Developer to excel and CSV format? Have you ever just banged your hands at the keyboard, closed your eyes, and thought “Is it supposed to be this hard?”. Well, the answer is NO. This post will guide you step by step with necessary screenshots through the whole process of Oracle SQL Developer export to excel & CSV format.

Table of Contents

It’s every developer’s dream to be able to manipulate and convert their data into any format. Often this takes a lot of effort and resources just to get the already painstakingly gathered data to the desired format. One such example is exporting your data from Oracle SQL Developer to excel and CSV format.

Introduction To Oracle SQL Developer

Oracle offered a database IDE in the form of Oracle SQL Developer. It supports the graphical user interface i.e. any user or administrator can perform the database activities in fewer clicks. It simplifies Oracle database development and management on a traditional and cloud-based platform. They also provide export and import utilities to their users. You can explore more about the functionalities of Oracle here.

Oracle’s main objective is to save the user’s time and effort in every possible way. So, the process of Oracle SQL Developer export to excel and CSV format should be a painless and ephemeral task. Let’s see how you will conquer this feature of Oracle.

Hevo offers a faster way to move data from databases such as Oracle; SaaS applications and 100+ other data sources into your data warehouse to be visualized in a BI tool. Hevo is fully automated and hence does not require you to code.

Let’s look at the benefits of using Hevo:

  • Secure Data Transfer: Hevo offers two-factor authentication and end to end encryption, which makes sure that the data movement is safe and secure.
  • Fully-Automated: Hevo platform requires minimal maintenance and management. This fully automated service is a wise choice for anyone.
  • Auto Mapping: It can automatically create the schema by mapping the data from the source to the destination schema. Hevo takes care of the mapping even when there are changes in the latter stage.
  • Scalability: Hevo can handle millions of records per minute without any latency. The data pipelines are scaled according to the requirement.
  • Friendly Live Support: Hevo team is ready to offer a helping hand at any time through emails, chat, and calls.

Sign up here for a 14-Day Free Trial!

Источник

How SQL Developer Export to Excel

Export to Excel

The export function for query result is not so obvious for developers to find out. In this post, I will show how to export query result as a Excel file.

Show Query Result as Grid

To show the query result in a grid table, you have to use F9 or Ctrl + Enter to format query result in grid.

SQL Developer Query Result

Right Click Mouse and Export

Move your cursor over anywhere on the grid and right click the mouse, you will see Export option.

SQL Developer Query Result — Export

Export Entire Table

If the data you want to export is a table, not a query result, you can directly right-click on the table and select Export in the menu.

SQL Developer — Table Menu — Export

Select Export Format

SQL Developer showed Export Wizard window for interaction. Although there’re many export types for us to select, we chose Excel format in this case.

SQL Developer Query Result — Export Format — Excel (.xls)

Select Text Encoding

I chose UTF-8 in order to match the database encoding.

SQL Developer Query Result — Export Encoding — UTF-8

Customize Filename

If you want to change the path, you can click Browse to navigate and choose a right directory to place.

SQL Developer Query Result — Export File Name — Browse

Review Export Job Before Executing

You can expand all options to see the content of the export job.

SQL Developer Query Result — Export — Summary

Check Content of Excel File

We open the Excel file in an application, so they can be viewed its content below.

SQL Developer Query Result — Export — Excel File Content

Источник

Tutorial: Exporting Query Results

This is a 101 level type of topic – a fundamental bit of SQL Developer that I would encourage everyone to be familiar with. Why? Because it’s probably something you’ll be doing, A LOT. So let’s get into it, already!

You have two options for getting data from a query into a FILE.

  1. right-clicking on a result grid
  2. spooling to a file

Grid Exports

The ubiquitous data grid!

Spooling

Exporting Data from a Grid

Here’s what happens.

You’re executing a query, browsing a TABLE, or running a report.

You right-click on it.

What happens next?

You get a 2 screen wizard. The first screen looks like this:

Here comes trick #1

Trick #1: You’re going to be doing this, A LOT. So, go into preferences and setup your defaults. You can see by my screenshot that I’m most frequently doing CSV exports directly to my clipboard.

Once you’ve set what you want, and click NEXT, you review what you’ve asked for and say FINISH.

But then what happens?

WE EXECUTE THE QUERY AGAIN. Grab the results, format them based Wizard settings, and feed them to the destination you’ve selected.

Trick #3: If you’re dealing with a large amount of records and are exporting to Excel, always choose the XLSX format (we list it first). If you choose XLS instead, stubbornly, it’s going to peter out after a hundred thousand rows or so…if you do not see the XLSX format option, that means YOU NEED TO UPGRADE SQL DEVELOPER.

Trick #4: If you have BLOBs in your query resultset, the ONLY way to export those out successfully is to use the Loader format option.

Exporting Data from a Script

Once you’ve ran the script and are looking at the results, the only way to get those into a file is to copy/paste.

So, what you need to do is tinker with your script, and have it use the SPOOL command.

SPOOL is a SQL*Plus feature that we support in SQL Developer. You have access to this command and other script processing bits when you use THIS button (or F5) to execute something.

This one!

We do better than just support the SPOOL command. We have built some additional commands to make working with FILES much easier.

Let’s look at this ‘script’:

The ‘cool’ parts of this script are:

And that’s it. Well, that’s ALMOST it. If you have a VERY LARGE result-set, writing those query results to the screen AND to the file at the same time is going to be a major BUMMER.

And now you know, the rest of the story.

I’m a Distinguished Product Manager at Oracle. My mission is to help you and your company be more efficient with our database tools.

Product Managers who Blog..about their Products

Quick Tip: Spooling to ‘Excel’

Oracle REST APIs & Query Parameter Examples using EMPLOYEES

Using SQLcl & Liquibase DIFF command to compare schemas

Export your Oracle Autonomous Database using Data Pump

SQL Developer Web: Cleaning up data loading error logs

Data Pump & SQL Developer Web for Oracle Autonomous Database

ORDS & SQL Developer Web 22.4.2 – Self Service Schemas

Hi Jeff, when exporting to .xlsx or .csv is it possible to change the font the data is exported in?

I doubt we assign a font to a csv file…

Do you mean file encoding?

Hope you are well. I have been trying to export the result of a query. However I seem to get the following stack trace:
java.lang.NullPointerException
at java.io.File.(File.java:277)
at oracle.dbtools.raptor.export.ExportGenerationOutputStream.closeCurrentStream(ExportGenerationOutputStream.java:537)
at oracle.dbtools.raptor.export.ExportGenerationOutputStream.finished(ExportGenerationOutputStream.java:464)
at oracle.dbtools.raptor.export.ExportAPI$1.doWork(ExportAPI.java:1490)
at oracle.dbtools.raptor.export.ExportAPI$1.doWork(ExportAPI.java:1453)
at oracle.dbtools.raptor.backgroundTask.RaptorTask.call(RaptorTask.java:199)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at oracle.dbtools.raptor.backgroundTask.RaptorTaskManager$RaptorFutureTask.run(RaptorTaskManager.java:702)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)

The actual query that I am trying to run is about 660KB in size. I tried to reproduce the issue with the different query – shown below. The version of SQL developer is v18.4 . I was able to reproduce on v20.2 as well.

select sysdate, case when (1 = 2 or 1 = 2 or …. 1 = 2) THEN ‘EQUAL’ ELSE ‘NOT EQUAL’ end as CASE_VALUE from dual;

Around the time this SQL query reaches 8260-8280 bytes in size. The export from SQL developer fails with the above stack trace.

Just in case, please go try version 20.4, it has lots of bug fixes over 20.2.

Источник

Nooooooo.

set sqlformat csvspool c:file.sqlselect * from table;spool off;

then open the file in excel.

OR

Run your query interactively.

Right click on the grid, Export > XLSX. Open the file.

Spool only writes the query output to the file, it doesn’t look at the file extension and figure out HOW to write the output at that point.

So you either have to code it yourself via the query, or use one of the format outputs we support

SET SQLFORMAT  CSV  JSON  DELIMITED  XML  HTML  INSERT  LOADER

Use ‘help set sqlformat’ for help.


Like this post? Please share to your friends:
  • Export to excel from javascript
  • Export to excel from delphi
  • Export to excel from asp
  • Export to excel format
  • Export to excel devextreme