Oracle sql developer выгрузить результат запроса в excel

I got some records from Oracle SQL developer & in the output query result. I want to copy the data & paste into the Excel sheet. How to copy the records from output of oracle SQL developer to Excel sheet.

asked Dec 14, 2017 at 7:23

Shahin P's user avatar

2

As I understand, accepted answer will get you results w/out headers. You can use right-click on results -> export there use clipboard as save-as, format -> delimited and the trick — delimiter to TAB (at least with tab paste works properly for my Excel version, default comma does not).

answered Mar 19, 2019 at 14:28

Alex Martian's user avatar

Alex MartianAlex Martian

3,3147 gold badges35 silver badges69 bronze badges

It’s simple, select all the records from the output query result and copied it by using Ctrl+C then after open new DataBase File on top left side of the Oracle SQL developer. Then after paste all the data there into that DataBase File. Again copied the data from that DataBase files using Ctrl+C & paste it into the Excel Sheet.

answered Dec 14, 2017 at 7:39

Md Wasi's user avatar

Md WasiMd Wasi

4563 silver badges16 bronze badges

1

Click on a cell in the output query results column and then press Ctrl + A to select all the records from the output query results. Then, press Shift+Ctrl+C to copy all the data and now go to your excel sheet and paste it.

answered Feb 27, 2022 at 22:45

Guest's user avatar

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.

  • Click to view our Accessibility Policy
  • Skip to content

How-To Document

How to Export Data using SQL Developer

Updated: Nov 2009 for SQL Developer 2.1
After completing this How-To, you should be able to understand:

  • How to export data to various file formats using SQL Developer
  • How to export the object definitions in your schema
  1. Introduction
  2. Oracle SQL Developer provides utilities to export both the definitions of the objects in a schema and the data stored in those objects. In this How-To we start by exporting the data and then move onto exporting object definitions.

  3. Software Requirements
    1. Oracle SQL Developer
    2. Oracle Database 9.2.0.1 or later
    3. Access to the Sample User Account HR (See Step 2 of this Getting Started: Oracle SQL DeveloperGuide)
  4. Exporting Data

    SQL Developer provides the ability to export user data to a variety of formats: CSV, XML, LOADER, TEXT, INSERT, HTML and XLS.

    1. In order to export the data from a table you can either use the SQL Worksheet and write a SQL query to retrieve the required data or you can Click on the Data tab of a table definition. We’ll use this latter approach.
    2. Expand the Connections Navigator and the Tables node.

      Click on DEPARTMENTS.

      Select the Data tab.

    3. Right-click anywhere on the data to invoke the context menu.
    4. Select insert from the Export Data context menu. This will produce a file of insert statements.

    5. Choose an appropriate directory and name for the file.
    6. You can also fine tune what is exported by selecting the columns and adding a where clause to reduce the number of records returned. In this example, we’ll take the default of all the records and columns.

    7. Click Apply to create the file.
    8. To review the file created, click the Open Folder icon  . Select the new file DEPARTMENTS.sql from your file directory. The sql file will open into a SQL Worksheet.
  5. Exporting Object Definitions

    SQL Developer provides the ability to export some or all of your object definitions to script files. You can use these as a backup of the object definitions or run them in another schema. In this exercise, you export all the object definitions and the data for the Departments table.

    1. Using the main menu, select Tools->Database Export.
    2. An Export wizard will open. At the top of the screen, enter a directory and file name. e.g. C:WorkingexportDept.sql. and select the Connection.
    3. Set the DDL Options for this Export. e.g. check Include Drop Statement.
    4. Click Next.

    5. In this step, you can slect what Object Types to export. We will take the default for all object types.

      Click Next.

    6. In this step, you can specify the objects to export. Instead of querying all objects by immediately selecting Go, you can enter a restriction criteria. Enter D% and then click Go.
    7. You can restrict the list of choices further by using the drop list on the right.. Select Table from the list of object types.
    8. Click Go. The list now displays tables that start with «D».

    9. Select the table Departments and shuttle to the right hand panel.
    10. Click Next.

    11. In this step, you can specify the data that gets exported. Click Go and a list of tables will be listed. Shuttle Departments to the right hand panel..
    12. Click Next.

    13. In this final step, you can review your Export Summary.

      Click Finish.

    14. To review the file created, go to the main menu and select View-> Files to open the Files Navigator tab. Select the new file exportDept.sql from your file directory. The sql file will open into a SQL Worksheet.
  6. Additional Resources
  • There are many SQL examples in the Database Documentation on OTN
  • Discuss this how-to in the OTN SQL Developer Forum.

Like this post? Please share to your friends:
  • Oracle sql developer import from excel
  • Oracle sql and excel
  • Oracle smart view excel
  • Oracle odbc driver 64 bit excel
  • Oracle external table excel