This question comes up about as frequently as the ‘how do I export data to XLS?’ question. It’s pretty simple once you’ve ran through the process a few times. But you may be here because you’ve never ran through the process before.
This post will step you from beginning to end. You should be prepared to import data to an existing table from Excel with confidence after reading this post. You can use SQL Developer to create a new table for your Excel data, but that will be covered in a subsequent post.
Warning: This post has a LOT of pictures.
For our example I’ll be using HR.EMPLOYEES to build the XLS file. I have created a blank copy of the table in another schema and want to import the data from my excel file over.
Step 0: The Empty Oracle Table and your Excel File
You have an Oracle table and you have one or more Excel files.
You do know how to view multiple objects at once in SQL Developer, right?
Step 1: Mouse-right click – Import Data
Step 2: Select your input (XLS) file
Step 3: Verify the data being read
Does your Excel file have column headers? Do we want to treat those as a row to the table? Probably not. The default options take care of this. You can also choose to preview more than 100 rows.
Here’s what it looks like if you uncheck the ‘Header’ box
Sometimes your Excel file has multiple headers, or you may need to only import a certain subset of the spreadsheet. Use the ‘Skip Rows’ option to get the right data.
Step 4: Create a script or import automatically
For this exercise the ‘Insert’ method will be used.
Step 5:
You may have an Excel file with 100 columns but your table only has 30. This is where you tell SQL Developer what columns are to be used for the import. You can also change up the column order, which may make the next step a bit easier.
Step 6:
If you’re not paying attention and just letting the wizard guide you home, then now is the time to wake up. There’s a good chance the column order of the Excel file won’t match the definition of your table. This is where you will tell SQL Developer what columns in the spreadsheet match up to what columns in the Oracle table.
Step 7: Verify your settings
Hit the ‘verify’ button. Fix any mistakes.
SQL Developer is telling you it doesn’t know how to reconcile the data for this DATE column. We need to know what the DATE FORMAT is.
So we need to go back to the Column definition wizard and inspect the HIRE_DATE column settings.
You need to look at how the dates are stored in the spreadsheet and write them in terms that Oracle can understand. This will be used on the INSERTs via a TO_DATE() function that will turn your Excel string into an actual DATE value.
After correcting this, go back to the Verification screen and see if that fixes the problem.
Step 8:
Click on the ‘Finish’ button.
Step 9: Verify the import look at your new table data
Note the ‘Log’ panel. SQL Developer is processing the records in batches of 50. No errors and the data is there!
Just a few more pointers when it comes to Excel
- Storing data in Excel can be…dangerous
- If you have a lot of data or if this will be a repeating process, consider External Tables or SQL*Loader instead
- If you like to put data in Oracle because you understand SQL better than Excel macros, then welcome to the club













Twitter
RSS
GooglePlus
Facebook
May 26, 2012 @ 01:30:33
nice ,this info is very imp for me ,thanks
Jun 07, 2012 @ 05:09:23
Great work…….
Jun 07, 2012 @ 20:27:37
Thanks Suresh!
Jun 07, 2012 @ 19:40:32
This is very informative.
I have a question though. How to do a weekly import with out going through all the steps? Automatic importing , I should say.
Jun 07, 2012 @ 20:27:22
First we walk, then we run.
Something we’re kicking the tires on is a more powerful command-line interface. This would allow you to call SQLDev features via your scripts, which you could then schedule via your native OS scheduling interface.
If it’s a regular activity and you want to automate it today, something you may want to look at is using SQL*Loader. Until we have what you want in SQL Developer, you could define your ctl file for your Excel data – which would need to be converted to a CSV, then you could achieve what you want.
Thanks for the feedback Scott!
Jun 08, 2012 @ 11:17:17
Thanks for the reply!
I hope this is not a lot to ask but would you mind walking me into the process?
What should I do first? I’m not well learned with oracle/sql stuff.
Jun 08, 2012 @ 11:56:40
It may require a bit more coding than you’re comfortable at this time, but if you’re willing to to a bit of research, it WILL work. Try reading this FAQ first to get an idea of what’s involved. http://www.orafaq.com/wiki/SQL*Loader_FAQ
Once you define what the data stream looks like, you can use windows or *NIX scheduling to run your script on demand. And it will be FAST.
There are MANY utilities out there for loading Excel data to Oracle. They are not free.
This process will be free, but it will require more work.
And the process will continue to evolve and get better in SQL Developer of course!
Jun 08, 2012 @ 12:18:18
Thanks a lot! I’ll read and study more and hopefully get a sufficient knowledge to tackle this.
* Programming is fun when you know what the heck your doing! lol.
Jun 13, 2012 @ 03:54:05
Thanks a lot !
Jun 19, 2012 @ 11:08:32
SQL Developer is as cool as Jeff smith…Arif
Jun 19, 2012 @ 11:24:54
No, it’s much cooler than me
But thanks. I think.
Aug 09, 2012 @ 13:00:44
I need to convert some legacy VFP6 data files. I know we can use Excel to convert it to *.csv files. But, how we convert data from Excel *.csv files into brand new Oracle tables (from scratch)? I am new to Oracle, so be kind with me. I need a very basic, step by step sample.
Thanks
Aug 09, 2012 @ 13:09:20
Short answer, we can do that.
Long answer, see the first link in the very beginning of this post. I’ve composed a follow-up to this tutorial on how to create a new table from an existing spreadsheet.
Aug 14, 2012 @ 05:35:53
Hey,
So I was following this. I’ve just been coming to grips with Oracle for an internship.
I get a ‘ORA 00928: missing SELECT keyword’ error for every record and nothing gets inserted into the database. I cleared the date values and matched columns.
According to Oracle Help, this happens when I’m inserting into a view without selecting. But here, quite obviously, I’m inserting into a table.
Any ideas?
Aug 14, 2012 @ 08:28:23
Change your IMPORT method to ‘Insert Script.’ When the script is loaded into your worksheet, run it with F5. Then we can see exactly where your ORA-00928 is coming from.
Aug 15, 2012 @ 02:49:38
Turns out I was running an older version of SQL Developer. Switching to a newer version magically fixed that.
Also, is there any way of directly importing DBF files in a similar manner?
The only way I’ve figured out till now is opening each file in excel, saving as xls/xlsx and then doing this. I have multiple files and was wondering if you could point me in the right direction. Writing a script maybe?
Oct 13, 2012 @ 09:48:52
Hi, I hope you can help me. I’ve just started a new job and they are using the Oracle system. Blanket purchase orders are sent out to the supplier with required delivery dates. On a daily basis requests for quicker delivery dates are generated by Oracle. The requests can be downloaded from Oracle into excel and sent to the supplier.
I need to know if the supplier replies with a new improved delivery date in excel is it possible to upload the new delivery date directly into oracle from excel ? I have asked the people in my department and they have informed me it’s not possible and I have to change the date manually within Oracle. However this is a long process and I would have thought an upload would be possible.
Oct 13, 2012 @ 11:00:50
Of course it’s possible
The question is SHOULD you do it this way. Here’s an example of hooking Excel up directly to the database using ODBC
http://hoopercharles.wordpress.com/2010/01/12/select-from-or-update-a-database-table-based-on-the-contents-of-an-excel-spreadsheet/
I’m not advocating that you do this, but you can see what Charles is doing and decide if you want to go in that direction.
You could turn the problem on it’s ear and build a web application using APEX and have the suppliers update their dates directly – even to a staging database where you could then use SQL to update your production system. Or even have a job that does that for you auto-magically.
But yes, it’s possible.
Nov 07, 2012 @ 13:39:48
I’m on sqldeveloper 3.1.07 and using Office 10. I successfully complete the process through the verificaton step (with all successes), click finish and then sqldeveloper either freezes up or I get a popup box that says: Import data into table SWBDEPT from file CampusDirectory.xls . Task failed and import rolled back. It doesn’t give me any more information than that. I’ve tried using both .xlsx and .xls formats with the same results. We are on oracle 11g. Any Ideas?
Nov 07, 2012 @ 14:05:36
My first idea is that the JVM memory is being exhausted. Reading in the data from Excel is kind of expensive today in SQL Developer. How big is your spreadsheet, number of rows?
As a test, save your XLS as a CSV and try the import. If it works right away, that’s the issue. The temp fix is to increase the memory in our sqldeveloper.conf setup/config file. The long term fix involves an update internally on how we work with Excel – which is coming!
Nov 07, 2012 @ 17:55:54
That did the trick! I saved it as a CSV and loaded it without additional problems..I only had 260 rows on the spreadsheet to insert.
Thanks for your help,
sandy
Nov 07, 2012 @ 19:41:55
Glad to hear that worked, but a bit concerned we couldn’t handle your XLS file. If the info in it isn’t of a secure nature, feel free to email it to me at jeff.d.smith@oracle.com so I can debug what’s going on and make sure it’s fixed going forward.
Nov 15, 2012 @ 15:01:50
Hello, I am trying to import Data from Excel file to Oracle table. I am using import available in sql developer, but i need to do on daily basis. any ideas, suggestions. please help. Also, pls guide how to use the SQL Loader ? Many thanks, Nilam
Nov 16, 2012 @ 10:58:02
Get it into a SQL*Loader friendly format, like CSV. Then you’ll want to set it up to run in SQL*Loader. That’s an option in the Import wizard. After you’ve stepped through it you’ll be left with a set of files including a script. You’ll want to setup an OS job to run that script on a daily basis, making sure that you also have scripted the daily input file to be placed where the job is going to look for it. I have a post on how to use SQL*Loader with SQL Developer – it’s on my ‘Popular Posts’ widget to the right of the blog content.
You’ll want to read up on SQL*Loader in our Oracle Docs as well.
Dec 19, 2012 @ 12:03:40
In trying to follow your example, I cannot proceed past step 4. The “Import Method” list is empty, so I can’t choose Insert or Insert Script. When looking at Tools->Preferences, the Database->Utilities->Import->Import Methods setting shows “Insert” as the default value for both Existing Table Import Method and New Table Import Method.
Any idea why the list would be empty, and how I might correct this?
Dec 19, 2012 @ 12:13:11
I’m sorry to hear you’re having problems Alex.
A few questions:
If you’d like, you can email me your data file and I can try to reproduce the problem here locally – jeff.d.smith@oracle.com
Dec 21, 2012 @ 16:12:27
SQLDeveloper 3.2.20.09.87
Windows 7
JDK 1.6.0_37
Excel file — but it also happens with a regular plain text CSV file.
I don’t think it has anything to do with the particular data I’m using. I was able to successfully import the same XLS file with dbVisualizer. I also created a dummy csv file with 2 rows of data in it — and that yields the same results (nothing in the import method list) as trying to use the Excel file.
I’ve even tried importing the data into a different table (in the same schema), and the list is still empty.
Do I need a certain set of permissions on the Oracle database for this to work in SQLDeveloper? I have a limited-access user id where I can query/insert/delete data but not perform any schema-relatated activities (add/drop tables or columns, etc.). I wouldn’t expect this to be the case, because dbVisualizer works correctly…
Jan 02, 2013 @ 12:09:29
Some notes from the developer -
Dec 27, 2012 @ 19:18:13
I have inner joy at finding your blog, I’m a big fan of sql developer, I use a Mac at home. I am quite new to Oracle so your posts are very useful. I used to be an avid Excel person but after learning just the basics of sql I know I won’t be using Excel in the same way ever again.
I’ve just spent nearly two days trying to get 11g2 working on ora6 via virtual box. So your post on getting sql developer working on the Mac was very welcome for my fried brain.
Keep up the good work!
Jan 09, 2013 @ 05:23:42
Thank you very much for this tutorial!
Jan 09, 2013 @ 12:47:42
You’re welcome Oleksiy!
Jan 17, 2013 @ 14:27:52
Thanks! This was great! The only other thing I ran into is that my numbers had commas in them in the csv from when I converted from xls, so I had to modify the csv accordingly. Once I changed the format, it worked great. You saved me a ton of time. Thanks again
Jan 17, 2013 @ 15:06:09
There should be way to get the commas out of the source data…let me know if you’re interested in figuring that out.
Thanks for sharing your experience with us!
Jan 17, 2013 @ 18:08:27
I did get the comma out of the source because I changed the format for that column, but thanks.
Jan 24, 2013 @ 09:41:30
I have run into an issue at times when the Data Import Wizard will not deploy. The File-Log section will show that a file is open but the wizard is not displayed. Any ideas as to why this occurs? Thanks!
Jan 24, 2013 @ 09:49:36
Are you working with an XLS or XLSX file? If so, how big is it?
Could be we’re running out of memory – an issue we know about and are working on.
You can launch sqldveloper from the bin directory and get a command console to see any error messages that are occuring when you get to that step…or you could just try to increase the amount of memory for SQL Developer in the sqldeveloper.conf file by modifying this line
AddVMOption -XX:MaxPermSize=256M
Or you could try saving your xls file as a CSV and trying that – no memory issues with CSV files.
Or it could be something completely different
Jan 24, 2013 @ 11:13:40
Increasing the Max Perm size to 512 seems to have resolved the issue. Thanks for your help!
Feb 11, 2013 @ 11:18:50
Thank you for this webiste!
I would like to know if I can change the defualt path on the “Import Data” menu option after right clicking on a Table.
I am using version 3.1.07 or Oracle SQL Developer.
Thanks for your time.
Feb 11, 2013 @ 11:20:37
Dang. Sorry for the typos. “default” path, and “of” Oracle SQL Developer.
Feb 11, 2013 @ 11:54:46
Yes – and don’t mind the typos!
Tools > Preferences > Database > Utilities > Import > Default Import Directory
It’s not like we buried it, or anything
Feb 11, 2013 @ 12:02:19
Thanks for the quick reply!
Right after I submitted the question, I noticed the list of folders on the left that pops up after clicking on the Import Data option and one of them is the folder that I wanted to be my default…so I may not even need to change the default.
I appreciate your response.
Mark
Feb 19, 2013 @ 22:37:07
Very nice explanation in this post. I have a question, I am using excel 2007 and created a small file with few rows. Each row has data which is linked with other worksheet in same files. During import in SQL Developer, I could not see any row in the table which has linked data with other sheets. I used past link special option here. But if I am using simple data row (without paste link special option) then Import is fine. Any idea how can I fix this problem in file with paste link special option? I will appreciate.
Feb 20, 2013 @ 14:46:59
I’m guessing that’s a failing of the POI Apache library we’re using…which might get updated soon.
In the meantime, you could work around this by saving your XLS file to a CSV file and do the import from there – which should run even faster.
Feb 20, 2013 @ 16:48:34
Thanks for quick response. I appreciate your response.
Mar 06, 2013 @ 02:04:18
Hi Smith,
I have a samll query, is there any row limit when we try to import the data from excel file. Cause I’m trying to insert 10k records but the process is rolling back.
Mar 06, 2013 @ 07:02:57
What does the log show Waheed? Is SQL Developer freezing/becoming unresponsive during the wizard, or are you getting an error message? Please tell me what you are seeing.
When importing large amounts of data via Excel, you may need to increase the amount of memory available to SQL Developer via the JVM – that would be the solution if the application becomes non-responsive. Let me know and I’ll send you the directions if necessary.
Mar 06, 2013 @ 09:59:25
the message displayed is “Import Data into table TABLE_NAME from the file.xlsx. Task failed and import rolled back.”, I see that the issue is cause because of the erroneous data in the file now it’s resolved
Thank you very much for your response.
Mar 06, 2013 @ 11:37:59
Hi,
This is really useful info. I used this as it is. Thanks much
Mar 06, 2013 @ 11:39:49
You’re very welcome!
Mar 07, 2013 @ 11:24:21
Great tutorial,
But no joy for me.
I get a error message at step 8
Any thoughts?
–Insert failed for rows 1 through 50
–ORA-04091: Tabel CRP.ITEM wordt gemuteerd en mag niet door trigger/functie worden benaderd.
ORA-06512: in “CRP.RECORD_ID”, regel 33
ORA-06512: in “CRP.RECORD_ID_TRIG”, regel 4
ORA-04088: Fout bij uitvoering van trigger ‘CRP.RECORD_ID_TRIG’.
Mar 12, 2013 @ 11:45:58
The easiest solution would be to disable any INSERT triggers you have on the table. The problem is with the triggers, not with SQL Developer. I’m guessing if you used the SCRIPT vs INSERT option, and ran the script via SQL*Plus you’d see the exact same errors. Is there a DBA you can consult?
Apr 03, 2013 @ 22:18:10
Thanks Jeff for the walk through.
I walked along successfully till the end ( with date format issues ) and upon “Finish”
Problem
SQL Developer freezes.
Environment
I’m on Mac 10.7.5 with SQL Developer 3.0.04
Is this the JVM settings thing ? I’m importing less than 10 rows (12 columns)
Your help is much appreciated
Apr 03, 2013 @ 22:31:01
Sorry forgot to mention … Not sure if this can have implications :
Oracle SE server Instance is Amazon RDS
Apr 06, 2013 @ 11:04:32
Question #1: Why are you using SQL Developer 3.0.04? Can you upgrade to version 3.2.20_09?
Something you could try: have SQL Developer generate an INSERT script to the worksheet instead – that’s an option in the wizard. Then run that script to move your data into your table. If it hangs there too, then there’s something funny with your spreadsheet. Feel free to send me your XLS file if you want me to investigate further, jeff.d.smith@oracle.com.
Apr 08, 2013 @ 23:52:32
First, i upgraded my SQL Developer to 3.2.20.09 Looks good.
I got the INSERT generated earlier but to analyze or copy the IDE used to freeze immediately. Now i got the INSERT script generated and says
“ORA-01722: invalid number”
My XLS is having numbers in couple of columns like, 1, 610, 66945
While importing during the Data Preview phase i noticed that the values are coming as floating points like 1.0, 610.0, 66945.0
Then i made the corresponding columns formatted as Text and the Data Preview was all good.
But the INSERT failed because those floating points came up again. Not sure if this is some very simple setting in my MS Excel 2008 for Mac
Thank you very much for your response and your help in this regard.
Apr 09, 2013 @ 20:52:20
Randomly it caught my eye and now it is going to help me a lot…Thank you very much.
Apr 10, 2013 @ 01:07:41
i want to run a sql query everyday at 5.30 pm.Cn u pls help me to do this automatically and place the output in a folder.i use only sql developer to connect to database.But my database does not have scheduler option ?Thanks in advance.
Apr 10, 2013 @ 03:01:42
Every Oracle database has a scheduling option. DBMS_SCHEDULER or DBMS_JOBS. You could also setup a sql*plus script to run via OS scheduler and use the spool command to capture the output.
Apr 10, 2013 @ 03:29:57
Hi thatjeffsmith,
Thank you so much for ur response.Can you pls explain me the steps to setup a sql*plus script to run via OS scheduler and use the spool command to capture the output.As i am beginner to the technology,i am not able to understand the tech terms clearly.
Apr 12, 2013 @ 14:41:51
Just to say: thank you very much.
Apr 12, 2013 @ 14:48:57
You’re very welcome!
Apr 17, 2013 @ 03:19:29
Hi
It was a real valuable imformation. I have one query. If we want to upload SYSDATE in the date field , then how to proceed? Can you help me out here?
Apr 17, 2013 @ 08:45:38
What I normally do in that case is define the DEFAULT value for that column as SYSDATE, then make sure that col value in the spreadsheet is a NULL, then when the load happens, the DB takes care of that for me.
Apr 18, 2013 @ 03:56:12
I have done the same thing but its not working out for me… It inserts NULL value in the table. What I found is that, when the internal import query is prepared (INSERT INTO XYZ VALUES (to_date(”,’DD-MON-YY)) it is inserting the NULL value.
NOTE: I have also defined DEFAULT value as SYSDATE for that column and haven’t passed any value in the excel column for that.
Apr 18, 2013 @ 08:14:46
Run a sample INSERT to your table, passing nothing for your date field. Then query the table. Do you see the SYSDATE time from when you ran the insert in your new record? If not, you haven’t set the DEFAULT property of your column definition for the table correctly.
Apr 18, 2013 @ 08:40:43
Thanks.. But I have tried that also…Not working.
The problem is the internal query which is generated. It takes the null value inside single qoutes(‘ ‘)(to_date(”,’DD-MON-YY’)). There is the problem! If that qoutes (‘ ‘) can be removed it will work.
Try this. Let the date field in the Excel have some manual date (put some random date) and leave some NULL. Then try to insert. Hope I am able to make you understand my problem… When you do that the data where you have specified the date gets inserted into the table. But the one you left blank will insert NULL value in the table, not the SYSDATE (which is required)….
Apr 18, 2013 @ 09:03:30
” is not a NULL – that’s your problem
Apr 19, 2013 @ 03:21:51
” is NULL, i know that. But I am not able to verify where to rectify ?
Can you please look into the scenario I have explained above and help me out?
May 13, 2013 @ 06:31:08
Thanks a lot. Excel files with huge row count (280K) in my case, this works fine with .csv. I tried with .xlsx file and had issue of slw developer going into hung status.